|
From: knittl <kn...@us...> - 2009-08-03 08:40:59
|
Module: performous
Branch: master
Commit: a7efbab3998c33875dde313a198134fb4a511279
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 22:30:58 2009 +0300
Minor fix for FPS calculator.
---
game/main.cc | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 59bb9dd..26ff642 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -151,22 +151,23 @@ void mainLoop() {
sm.activateScreen("Intro");
// Main loop
boost::xtime time = now();
- unsigned nb_frames = 0;
+ unsigned frames = 0;
while (!sm.isFinished()) {
checkEvents_SDL(sm, window);
window.blank();
sm.getCurrentScreen()->draw();
window.swap();
- ++nb_frames;
if (config["graphic/fps"].b()) {
+ ++frames;
if (now() - time > 1.0) {
- std::cout << nb_frames << " FPS" << std::endl;
+ std::cout << frames << " FPS" << std::endl;
time += 1.0;
- nb_frames = 0;
+ frames = 0;
}
} else {
boost::thread::sleep(time + 0.01); // Max 100 FPS
time = now();
+ frames = 0;
}
}
} catch (std::exception& e) {
|