summaryrefslogtreecommitdiff
path: root/src/interface/Engine.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-01-31 18:49:14 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-01-31 18:49:14 (GMT)
commit857b0cc1fc58f066acd59404d16ee5e566e20f00 (patch)
tree7607fc43f3bdd63687dff39209f44defa48e6a35 /src/interface/Engine.cpp
parent1d297cb57a338f2a9e34d0f16642afc6a83c1041 (diff)
downloadpowder-857b0cc1fc58f066acd59404d16ee5e566e20f00.zip
powder-857b0cc1fc58f066acd59404d16ee5e566e20f00.tar.gz
Load user information from preferences, fps display for testing
Diffstat (limited to 'src/interface/Engine.cpp')
-rw-r--r--src/interface/Engine.cpp15
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_)