/* Function: vUnitMenuState_Render Description - This is the new render state for the Base_State structure. It performs the render of the main (paused)game and also the unit menu. 1 argument: void *info - The Base_State that the render is a part of. */ void vUnitMenuState_Render(void *info) { Base_State *bs = info; Vent_GameState *vgs = bs->info; /*Draw the main game*/ Game_Render(info); /*Draw the unit menu*/ vUnitMenu_Draw(&vgs->game.HUD.unitMenu, ker_Screen()); return; }
int main(int argc, char *argv[]) { struct Window window; window.width = 1024; window.height = 768; window.flags = SDL_WINDOW_OPENGL; Window_CreateOpenGLContext(&window, "OpenGL"); Window_SetOpenGLFlags(); Game_Init(); GLfloat const dt = 0.01f; GLfloat t = 0.0f; GLfloat accumulator = 0.0f; GLfloat previous_time = 0.0f; while (Game_HandleInput()) { GLfloat new_time = SDL_GetTicks() / 1000.0f; GLfloat delta_time = new_time - previous_time; if (delta_time <= 0.0f) continue; previous_time = new_time; accumulator += delta_time; while (accumulator >= dt) { Game_FixedUpdate(t, dt); accumulator -= dt; t += dt; } Game_Update(); Game_LateUpdate(); Window_ClearBuffers(); { Game_Render(); } Window_SwapBuffers(&window); } Game_Destroy(); Window_Destroy(&window); return 0; }
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; }