diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-14 21:25:39 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-14 21:25:39 -0400 |
commit | 53a657b4c00f074ad96e59193fb8e408b4adb763 (patch) | |
tree | c4f0c94f01ad9b934d9b284edd398df65e4ee764 | |
parent | 45e83c53ee36d8999c00ebfc474d7ef3bb103c14 (diff) |
fps stuff
-rw-r--r-- | src/main.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index 905e4cd..e07e258 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -171,10 +171,15 @@ void render(){ glRectf(build.loc.x, build.loc.y, build.loc.x + build.width, build.loc.y + build.height); ///BWAHHHHHHHHHHHH - float d = deltaTime; - float fps = (1000 / d); + static float d,fps; + static unsigned int div=0; ui.setFontSize(16); + if(++div==20){ + div=0; + d=deltaTime; + fps=(1000/d); + } ui.putText(-.98 + player.loc.x, .94, "FPS: %1.0f",fps); ui.putText(-.98 + player.loc.x, .88, "DT: %1.0f",d); ui.putText(player.loc.x,player.loc.y-(HLINE*10),"(%+1.3f,%+1.3f)",player.loc.x,player.loc.y); @@ -197,8 +202,6 @@ void logic(){ else if(player.left)player.vel.x=-.00075; else player.vel.x = 0; - std::cout << deltaTime << std::endl; - currentWorld->detect(&player.loc,&player.vel,player.width); gw=currentWorld->getWidth(); if(player.loc.x+player.width>-1+gw){ |