commit e59f45bf4ff1dd0f11a14c51e25ff29a3e6ade0a parent 61a9c680e873b970b2510b42a730c78e21b29e48 Author: Michael Savage <mikejsavage@gmail.com> Date: Tue Dec 27 17:16:37 +0200 Call GameState constructor Diffstat:
main.cc | | | 14 | +++++++------- |
diff --git a/main.cc b/main.cc @@ -105,19 +105,19 @@ int main( int argc, char ** argv ) { GameMemory mem = { }; memarena_init( &mem.persistent_arena, persistent_memory, persistent_size ); - GameState * state = memarena_push_type( &mem.persistent_arena, GameState ); - mem.state = state; + static GameState state; + mem.state = &state; GLFWwindow * window = gl_init(); text_renderer_init(); - workqueue_init( &state->background_tasks, &mem.persistent_arena, 2 ); + workqueue_init( &state.background_tasks, &mem.persistent_arena, 2 ); #if STATIC_GAME - game_init( state, &mem ); + game_init( &state, &mem ); #else Game game = load_game( game_library_path ); - game.init( state, &mem ); + game.init( &state, &mem ); #endif const float program_start_time = glfwGetTime(); @@ -164,10 +164,10 @@ int main( int argc, char ** argv ) { input.keys[ KEY_EQUALS ] = glfwGetKey( window, GLFW_KEY_EQUAL ) == GLFW_PRESS; #if STATIC_GAME - game_frame( state, &mem, &input, current_frame_time, dt ); + game_frame( &state, &mem, &input, current_frame_time, dt ); #else if( game.frame ) { - game.frame( state, &mem, &input, current_frame_time, dt ); + game.frame( &state, &mem, &input, current_frame_time, dt ); } #endif