medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 8e30c529bc9e3d0a2b0c9060bb20c84e2285b600
parent a81edbf1ee1bf2e52ff5e95839aded29c432a9f5
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri Mar 25 21:43:56 +0000

Some cleanup in main

Diffstat:
main.cc | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/main.cc b/main.cc @@ -73,22 +73,23 @@ static bool should_reload_game( const char * const path, const time_t lib_write_ } int main( int argc, char ** argv ) { - const char * const game_library_path = argc == 2 ? argv[ 1 ] : "./hm.so"; + const char * game_library_path = argc == 2 ? argv[ 1 ] : "./hm.so"; - Game game = load_game( game_library_path ); - GameMemory mem = { }; + size_t persistent_size = megabytes( 64 ); + u8 * persistent_memory = ( u8 * ) malloc( persistent_size ); + if( persistent_memory == NULL ) { + ERROR( "couldn't allocate persistent memory" ); + } - const size_t persistent_size = megabytes( 64 ); - u8 * const persistent_memory = new u8[ persistent_size ]; + GameMemory mem = { }; memarena_init( &mem.persistent_arena, persistent_memory, persistent_size ); GameState * state = memarena_push_type( &mem.persistent_arena, GameState ); mem.state = state; - GameInput input = { }; - GLFWwindow * const window = gl_init(); + Game game = load_game( game_library_path ); game.init( state, &mem ); const float program_start_time = glfwGetTime(); @@ -115,7 +116,7 @@ int main( int argc, char ** argv ) { } // TODO: do this properly - input = { }; + GameInput input = { }; input.keys[ 'w' ] = glfwGetKey( window, GLFW_KEY_W ); input.keys[ 'a' ] = glfwGetKey( window, GLFW_KEY_A ); input.keys[ 's' ] = glfwGetKey( window, GLFW_KEY_S );