medfall

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

commit 9a6e5b2439b28d5a0d5c18349704968660f2b3f3
parent 80c8c31a52a7734771cb07c38a09429e7f53d54c
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Tue Aug 18 19:28:53 +0200

Add frame counter

Diffstat:
main.cc | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/main.cc b/main.cc @@ -82,7 +82,9 @@ int main( int argc, char ** argv ) { game.init( state, mem ); - float last_frame_time = glfwGetTime(); + const float program_start_time = glfwGetTime(); + float last_frame_time = program_start_time; + u64 total_frames = 0; while( !glfwWindowShouldClose( window ) ) { const float current_frame_time = glfwGetTime(); @@ -109,8 +111,12 @@ int main( int argc, char ** argv ) { glfwPollEvents(); last_frame_time = current_frame_time; + total_frames++; } + const float program_run_time = glfwGetTime() - program_start_time; + printf( "FPS: %.1f\n", total_frames / program_run_time ); + unload_game( &game ); GL::term();