render speed

This commit is contained in:
Priec
2025-11-14 11:08:33 +01:00
parent a1c742c1cd
commit ebe03f42b6
5 changed files with 14 additions and 534 deletions

View File

@@ -1,4 +1,4 @@
// src/render/loop.c
// src/render/loop.cpp
#include "loop.h"
#include "mbed.h"
@@ -15,7 +15,7 @@ static bool message_active = false;
void draw_mask(const char *unused_filename, int shift, const char *text = nullptr);
void render_loop() {
void render_loop(int speed) {
Timer msg_timer;
Timer anim_timer;
msg_timer.start();
@@ -49,8 +49,9 @@ void render_loop() {
}
// Animation tick
if (anim_timer.elapsed_time() >= 80ms) {
shift++;
if (anim_timer.elapsed_time() >= 200ms) {
// speed determines scroll steps per tick
shift += speed;
anim_timer.reset();
need_redraw = true;
}
@@ -59,9 +60,9 @@ void render_loop() {
if (need_redraw) {
draw_mask(bg_file, shift, message_active ? message : nullptr);
need_redraw = false;
ThisThread::sleep_for(60ms);
ThisThread::sleep_for(50ms);
}
ThisThread::sleep_for(20ms);
ThisThread::sleep_for(25ms);
}
}