Created
April 14, 2019 15:27
-
-
Save ainsleyrutterford/5607ffa09a174a079f30190e1391b766 to your computer and use it in GitHub Desktop.
Revisions
-
Ainsley Rutterford created this gist
Apr 14, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ Uint32 fps_lasttime = SDL_GetTicks(); //the last recorded time. Uint32 fps_current; //the current FPS. Uint32 fps_frames = 0; //frames passed since the last recorded fps. while (!quit) { if (update()) { fps_frames++; if (fps_lasttime < SDL_GetTicks() - 1000) { fps_lasttime = SDL_GetTicks(); fps_current = fps_frames; fps_frames = 0; } printf("Current FPS: %d\n", fps_current); } }