Commits

Bart van Strien committed 994d506

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

Comments (0)

Files changed (3)

src/modules/timer/Timer.h

 		* 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

src/modules/timer/sdl/Timer.cpp

 		// 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;
 		}
 		return dt;
 	}
 
-	double Timer::getFPS() const
+	int Timer::getFPS() const
 	{
 		return fps;
 	}

src/modules/timer/sdl/Timer.h

 		void step();
 		void sleep(double seconds);
 		double getDelta() const;
-		double getFPS() const;
+		int getFPS() const;
 		double getTime() const;
 		double getMicroTime() const;
 
 		Uint32 prevFpsUpdate;
 
 		// Updated with a certain frequency.
-		double fps;
+		int fps;
 
 		// The frequency by which to update the FPS.
 		double fpsUpdateFrequency;