That was only part of the problem, now it should all work properly (and more accurately)

This commit is contained in:
Bart van Strien
2012-03-03 11:42:39 +01:00
parent c2fb5618c1
commit dcb09c03a8
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ namespace timer
* once per second, it does not look erratic when displayed on screen.
* @return The "current" FPS.
**/
virtual double getFPS() const = 0;
virtual int getFPS() const = 0;
/**
* Gets the amount of time since the program started. Only useful for timing
+3 -3
View File
@@ -70,11 +70,11 @@ namespace sdl
// Convert to number of seconds
dt = (currTime - prevTime)/1000.0;
int timeSinceLast = (currTime - prevFpsUpdate)/1000.0;
double timeSinceLast = (currTime - prevFpsUpdate)/1000.0;
// Update FPS?
if (timeSinceLast > fpsUpdateFrequency)
{
fps = frames/timeSinceLast;
fps = int((frames/timeSinceLast) + 0.5);
prevFpsUpdate = currTime;
frames = 0;
}
@@ -91,7 +91,7 @@ namespace sdl
return dt;
}
double Timer::getFPS() const
int Timer::getFPS() const
{
return fps;
}
+2 -2
View File
@@ -55,7 +55,7 @@ namespace sdl
void step();
void sleep(double seconds);
double getDelta() const;
double getFPS() const;
int getFPS() const;
double getTime() const;
double getMicroTime() const;
@@ -70,7 +70,7 @@ namespace sdl
Uint32 prevFpsUpdate;
// Updated with a certain frequency.
double fps;
int fps;
// The frequency by which to update the FPS.
double fpsUpdateFrequency;