From 53a657b4c00f074ad96e59193fb8e408b4adb763 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 14 Sep 2015 21:25:39 -0400 Subject: fps stuff --- src/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') 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){ -- cgit v1.2.3