Unification Initialisation

From Wikiid
Jump to: navigation, search

The Unification main function uses the gameTools 'gameStarter' function to handle the signon screen and all of the user interaction necessary to get things started.

 const char *initialLevel = gameStarter ( argc, argv,
                               "unification", getenv ( "UNI_DATADIR" ),
                               UNI,
                               78.0f/255.0f, 14.0f/255.0f, 99.0f/255.0f ) ;

Then we initialise the random number generator using the time-of-day clock so no two games are exactly the same:

 srand ( (unsigned int) time ( NULL ) ) ;

Finally, we call the 'init' functions for all of the game subsystems:

 initClock         () ; showGLerror ( "After initClock" ) ;
 initScreen        ( UNI ) ; showGLerror ( "After initScreen" ) ;
 initCamera        () ; showGLerror ( "After initCamera" ) ;
 initEvents        () ; showGLerror ( "After initEvents" ) ;
 initObjects       () ; showGLerror ( "After initObjects" ) ;
 initGraphics      () ; showGLerror ( "After initGraphics" ) ;
 initSky           () ; showGLerror ( "After initSky" ) ;
 initDatabase      ( initialLevel ) ; showGLerror ( "After initDatabase" ) ;
 initParticles     () ; showGLerror ( "After initParticles" ) ;

The showGLerror(...) function helps to track errors in each of the subsystems that might cause an OpenGL error - which in turn messes up shader compilation and loading.