summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game.cpp12
-rw-r--r--src/game/interface.cpp2
2 files changed, 11 insertions, 3 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp
index bc8d3c7..185e2d1 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -307,7 +307,7 @@ void state_t::resume(void)
}
#define TIME_DELTA ((ntime_t)1000000000 / 100)
-#define TIME_LIMIT ((ntime_t)1000000000 / 10)
+#define TIME_LIMIT ((ntime_t)1000000000 / 20)
void state_t::tick(ntime_t time_)
{
@@ -344,7 +344,15 @@ void state_t::tick(ntime_t time_)
fc_game.tick();
if (nclock() - time_ > TIME_LIMIT) {
- frames_behind += target - frames_since_t0;
+ size_t left;
+
+ left = target - frames_since_t0;
+ t0 = nclock();
+ frames_since_t0 = 0;
+ frames_behind++;
+
+ interface->print("(Lag: " + std::to_string(left) + ")");
+
break;
}
}
diff --git a/src/game/interface.cpp b/src/game/interface.cpp
index 5b2d7b8..5872d17 100644
--- a/src/game/interface.cpp
+++ b/src/game/interface.cpp
@@ -381,7 +381,7 @@ void state_t::render_to(render::state_t *render)
x[1] -= em;
ss.str(std::string());
ss << std::fixed << std::setprecision(1);
- ss << "FPS: " << fc_render.freq_ma() << ", " << fc_game.freq_ma() << " Hz";
+ ss << "FPS: " << fc_render.read(SEC(1)) << ", " << fc_game.read(SEC(1)) << " Hz";
render->render_text(x, em, ss.str(), render::ALIGN_LEFT_TOP, sf::Color::White);
x[1] -= em;