diff options
Diffstat (limited to 'src/interface/Engine.cpp')
| -rw-r--r-- | src/interface/Engine.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/interface/Engine.cpp b/src/interface/Engine.cpp index 01a3e72..c4833d1 100644 --- a/src/interface/Engine.cpp +++ b/src/interface/Engine.cpp @@ -124,7 +124,7 @@ void Engine::SetSize(int width, int height) height_ = height; } -void Engine::Tick(float dt) +void Engine::Tick() { if(state_ != NULL) state_->DoTick(dt); @@ -175,9 +175,22 @@ void Engine::Draw() } if(state_) state_->DoDraw(); + + char fpsText[512]; + sprintf(fpsText, "FPS: %.2f, Delta: %.3f", fps, dt); + ui::Engine::Ref().g->drawtext(10, 10, fpsText, 255, 255, 255, 255); g->Blit(); } +void Engine::SetFps(float fps) +{ + this->fps = fps; + if(FpsLimit > 2.0f) + this->dt = FpsLimit/fps; + else + this->dt = 1.0f; +} + void Engine::onKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt) { if(state_) |
