|
|
@@ -36,21 +36,21 @@ void STATEMACHINE::run()
|
|
|
Timers::mode(0, true, false, false, 1, true);
|
|
|
Timers::load(0, 0);
|
|
|
const unsigned loop_time = TIMER_FREQ / 60;
|
|
|
- unsigned loop_next = -loop_time;
|
|
|
+ unsigned loop_next = loop_time;
|
|
|
unsigned last_update = 0, update_stamp, update_time;
|
|
|
unsigned last_frame = 0, frame_stamp, frame_time;
|
|
|
|
|
|
while (!stack.empty())
|
|
|
{
|
|
|
update_stamp = Timers::read(0);
|
|
|
- update_time = last_update - update_stamp;
|
|
|
+ update_time = update_stamp - last_update;
|
|
|
stack.back()->update(update_time);
|
|
|
last_update = update_stamp;
|
|
|
|
|
|
- if (Timers::read(0) > loop_next)
|
|
|
+ if (Timers::read(0) < loop_next)
|
|
|
{
|
|
|
frame_stamp = Timers::read(0);
|
|
|
- frame_time = last_frame - frame_stamp;
|
|
|
+ frame_time = frame_stamp - last_frame;
|
|
|
stack.back()->render(frame_time);
|
|
|
last_frame = frame_stamp;
|
|
|
|
|
|
@@ -63,8 +63,7 @@ void STATEMACHINE::run()
|
|
|
if (isKeyPressed(KEY_NSPIRE_ESC))
|
|
|
this->pop();
|
|
|
|
|
|
- while (Timers::read(0) > loop_next)
|
|
|
- ;
|
|
|
- loop_next -= loop_time;
|
|
|
+ while (Timers::read(0) < loop_next);
|
|
|
+ loop_next += loop_time;
|
|
|
}
|
|
|
}
|