From 3a2f69b3f1082b2fbdf39bd2a4f7ad0020971eac Mon Sep 17 00:00:00 2001 From: tom Date: Mon, 2 May 2016 15:39:22 -0500 Subject: spring cleaning, added framerate cap & started iterator replacement --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index ed41895..25d4cc4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,8 +6,12 @@ int main() List L(main); Event e; + Timer fps; + while(e.gRun()) { + fps.Start(); + while(e.Poll()) { if(e.gEventType() == SDL_QUIT) @@ -22,7 +26,9 @@ int main() L.Behavior(); main.Render(); - //SDL_Delay(10); + + if(fps.getTicks() < (1000 / 60)) + SDL_Delay((1000 / 60) - fps.getTicks()); } main.Destroy(); -- cgit v1.2.3