Proposed fix for timer callback after finished.
@@ -46,9 +46,8 @@ namespace blit {
for (auto t: timers) {
if (t->state == Timer::RUNNING){
if (time > (t->started + t->duration)) { // timer triggered
- t->callback(*t);
-
if(t->loops == -1){
+ t->callback(*t);
t->started = time; // reset the start time correcting for any error
}
else
@@ -58,6 +57,7 @@ namespace blit {
if (t->loops == 0){
t->state = Timer::FINISHED;
}
+ t->callback(*t);
}
}
}
