int main( int argc, char *argv[] ) { printf( APP_NAME"\n" ); common.running = true; common.path = argv[0]; {//Strip the file name + extension to get the current working directory int i = strlen( common.path )-1; while ( common.path[i] && i > 0 ) { if ( common.path[i] == '/' || common.path[i] == '\\' ) { common.path[i] = '\0'; break; } i--; } } printf( "Path is %s\n\n", common.path ); srand( (unsigned int)time( NULL ) ); R_Initialise(); Game_Initialise(); Input_Initialise(); while ( common.running ) { Input_Poll(); if ( common.running ) {//If the input handler picked up an exit, don't bother with the game R_ClearScreen(); Game_Render(); SDL_GL_SwapBuffers(); } } R_Shutdown(); Game_Shutdown(); printf( "Thanks for playing!\n" ); return 0; }
//----------------------------------------------------------// // WinSys_Main //----------------------------------------------------------// //-- Description // The main function. //----------------------------------------------------------// int WinSys_Main(LPSTR lpCmdLine) { if (WINSYS_OK != WinSys_Initialise()) { WinSys_Shutdown(); return 0; } //-- Attempt to Initialise the game if (IS_FALSE(Game_Initialise())) { //-- Initialise failed, so shut down nicely Game_Shutdown(); WinSys_Shutdown(); return 0; } //-- Main game loop while (true) { if (WINSYS_OK != WinSys_Update()) { //-- Loop until the message handler returns something not OK break; } Game_Main(); gWinSysGLWindow.SwapBuffers(); // while (IS_FALSE(m_FrameTimer.LockFrameRate(60.0f))) // { // //-- Todo more stuff while waiting for VSync. // gMemMgr.Update(); // gFileMgr.Update(); // } } //-- Shut down Game_Shutdown(); WinSys_Shutdown(); return 0; }