Here the code:
#define APP_XMLFILE "data/main.xml" #define APP_NAME "netrinjo-example" int the_main( int argc, char *argv[] ); int main( int argc, char *argv[] ) { return the_main( argc, argv ); } #include "SDL/SDL.h"// "SDL.h" cannot be included before main, if compiling with mingw #include "xmlapp.h" #include "sdlmanager.h" #include <iostream> int the_main( int argc, char *argv[] ) { // attach SDL_Quit to the exit routine, to make sure, that (in X11 fullscreen-mode) // the desktop will appear when the program quits (even if the app crashes). // You can also call SDL_Quit when closing the app, but the X11-fullscreen-mode will // not be quitted, if the app crashes! atexit( SDL_Quit ); // Construct the GameApp class (derived from BasicApp), using the program arguments XmlApp app( argc, argv ); string s = string(BasicApp::getThe()->getExePath()) + APP_XMLFILE; // if initialisation failed, exit the program if( !app.init(s.c_str()) ) return -1; // start the application's main loop return app.mainLoop(); }
For details on how the XML-file has to look like, etc. have a look at the example at http://netrinjo.sourceforge.net/