Open main menu

Difference between revisions of "HOWTO-Engines"

882 bytes added ,  23:41, 14 February 2006
Updated the HOWTO to show how the new engine specific debug levels are used.
(Elaborated more on our engine requirements)
(Updated the HOWTO to show how the new engine specific debug levels are used.)
Line 42: Line 42:


namespace Quux {
namespace Quux {
// our engine debug levels
enum {
kQuuxDebugExample = 1,
kQuuxDebugExample2 = 2
// next must be 4, because the debug levels must be able to be combined with OR
};


class QuuxEngine : public Engine {
class QuuxEngine : public Engine {
Line 126: Line 133:
// However this is the place to specify all default directories
// However this is the place to specify all default directories
File::addDefaultDirectory(_gameDataPath + "sound/");
File::addDefaultDirectory(_gameDataPath + "sound/");
// Here is the right place to set up the engine specific debug levels
Common::addSpecialDebugLevel(kQuuxDebugExample, "example", "this is just an example for a engine specific debug level");
Common::addSpecialDebugLevel(kQuuxDebugExample2, "example2", "also an example");


printf("QuuxEngine::QuuxEngine\n");
printf("QuuxEngine::QuuxEngine\n");
Line 133: Line 144:
// Dispose your resources here
// Dispose your resources here
printf("QuuxEngine::~QuuxEngine\n");
printf("QuuxEngine::~QuuxEngine\n");
// Remove all of our debug levels here
Common::clearAllSpecialDebugLevels();
}
}


Line 155: Line 169:
// Your main even loop should be (invoked from) here.
// Your main even loop should be (invoked from) here.
printf("QuuxEngine::go: Hello, World!\n");
printf("QuuxEngine::go: Hello, World!\n");
// This test will show up if -d1 and --debugflags=example are specified on the commandline
debugC(1, kQuuxDebugExample, "Example debug call");
// This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
debugC(3, kQuuxDebugExample | kQuuxDebugExample2, "Example debug call two");
return 0;
return 0;
}
}
561

edits