From 33c16ef44ef9ef0f89d7dd9fba62205816ce7ea0 Mon Sep 17 00:00:00 2001 From: exterlulz Date: Thu, 19 Aug 2010 14:28:47 +0200 Subject: [PATCH] fix timer thing, still *broken* --- src/main.cpp | 7 +++---- src/musk/actor.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3b23933..fe0ea75 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,6 +27,8 @@ int main(int argc, char **argv) bool quit = false; while (quit == false) { + timer.reset(); + // TODO: let the engine handle the events while (SDL_PollEvent(&event) == 1) { if (event.type == SDL_QUIT) { @@ -40,14 +42,11 @@ int main(int argc, char **argv) } scene.draw(engine.screen(), lastTicks); - lastTicks = 0; if (timer.ticks() < (1000 / fps)) { SDL_Delay((1000 / fps) - timer.ticks()); } - - lastTicks += timer.ticks(); - timer.reset(); + lastTicks = timer.ticks(); } return 0; diff --git a/src/musk/actor.cpp b/src/musk/actor.cpp index 4534c19..b3058e5 100644 --- a/src/musk/actor.cpp +++ b/src/musk/actor.cpp @@ -5,7 +5,7 @@ namespace musk { Actor::Actor(const Animation& animation) : Animation(animation), isMoving_(true), - movingDirection(kDirectionRight), + movingDirection_(kDirectionRight), // TODO: change back speed_ and destination_ as (0, 0) speed_(1, 1), destination_(120, 120) { -- 2.11.4.GIT