[escher] Rework of timers and bigger text in toolboxes

This commit is contained in:
Laury
2022-06-24 22:35:36 +02:00
parent 391fd5e243
commit 0b2a581177
74 changed files with 407 additions and 208 deletions

View File

@@ -3,16 +3,9 @@
#include <assert.h>
RunLoop::RunLoop() :
m_time(0) {
}
int RunLoop::numberOfTimers() {
return 0;
}
Timer * RunLoop::timerAtIndex(int i) {
assert(false);
return nullptr;
m_time(0),
m_firstTimer(nullptr)
{
}
void RunLoop::run() {
@@ -45,11 +38,12 @@ bool RunLoop::step() {
if (m_time >= Timer::TickDuration) {
m_time -= Timer::TickDuration;
for (int i=0; i<numberOfTimers(); i++) {
Timer * timer = timerAtIndex(i);
Timer * timer = m_firstTimer;
while (timer) {
if (timer->tick()) {
dispatchEvent(Ion::Events::TimerFire);
}
timer = timer->next();
}
}
@@ -65,7 +59,7 @@ bool RunLoop::step() {
#endif
if (event != Ion::Events::None) {
#if !PLATFORM_DEVICE
#if !PLATFORM_DEVICEdidStopAnimation
if (event == Ion::Events::ExternalText && !KDFont::CanBeWrittenWithGlyphs(event.text())) {
return true;
}
@@ -75,3 +69,27 @@ bool RunLoop::step() {
return event != Ion::Events::Termination;
}
void RunLoop::addTimer(Timer * timer) {
if (m_firstTimer == nullptr) {
m_firstTimer = timer;
} else {
Timer * actual = m_firstTimer;
while (actual->next()) {
actual = actual->next();
}
actual->setNext(timer);
}
}
void RunLoop::removeTimer(Timer * timer) {
if (m_firstTimer == timer) {
m_firstTimer = timer->next();
} else {
Timer * actual = m_firstTimer;
while (actual->next() != timer) {
actual = actual->next();
}
actual->setNext(timer->next());
}
}