summaryrefslogtreecommitdiff
path: root/engine/engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine/engine.cpp')
-rw-r--r--engine/engine.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/engine/engine.cpp b/engine/engine.cpp
index eccf495..278007e 100644
--- a/engine/engine.cpp
+++ b/engine/engine.cpp
@@ -12,9 +12,9 @@
#include <boost/format.hpp>
-void Engine::event_keypress(SDLKey key) {
+void Engine::event_keypress(sf::Key::Code key) {
switch(key) {
- case SDLK_SPACE:
+ case sf::Key::Space:
paused = !paused;
break;
default:
@@ -84,13 +84,10 @@ void Engine::update() {
glDisable(GL_TEXTURE_2D);
glColor4f(1, 1, 0, 1);
- unsigned int tick = SDL_GetTicks();
- if(tick - lastframes >= 1000) {
- fps = (float)frames * ((float)(tick - lastframes) / 1000.0f);
- frames = 1;
- lastframes = tick;
- } else {
- frames++;
+ if(++fps_frames >= 60) {
+ fps = float(fps_frames) / fps_clock.GetElapsedTime();
+ fps_clock.Reset();
+ fps_frames = 0;
}
glScalef(0.0005, 0.0005, 0.0005);
@@ -108,6 +105,4 @@ void Engine::update() {
stage->draw();
glDisable(GL_SCISSOR_TEST);
-
- SDL_GL_SwapBuffers();
}