Everything works as intended. No flicker anymore

This commit is contained in:
Rasmus Rasmussen 2026-01-09 20:43:35 +01:00
parent 9206972133
commit c90425cc6e
4 changed files with 8 additions and 23 deletions

View File

@ -78,6 +78,7 @@ void loop() {
if (_display_state->update_display.load()) {
_shell->draw_all();
im->draw_button();
th->push_sprite();
_display_state->update_display.store(false);
}

View File

@ -174,8 +174,6 @@ void Shell::minimize_window(short int window_id) {
}
void Shell::draw_all() {
tft->start_draw();
draw_background(0x0410);
draw_task_bar(0xbdf7);
@ -186,7 +184,6 @@ void Shell::draw_all() {
for (const auto& win : windows) {
if (!win->minimized) draw_window(*win);
}
tft->end_draw();
}
void Shell::draw_window(const Window& window) {
@ -228,8 +225,6 @@ void Shell::draw_window(const Window& window) {
for (WindowContentText text : window.window_content_text) {
tft->draw_text(text.x, text.y, text.text, COL_BLACK, text.size);
}
tft->push_sprite();
}
// ======= Desktop =======

View File

@ -14,34 +14,26 @@ void TFT_Handler::init(DISPLAY_STATE* display_state) {
sprite.createSprite(480, 320);
}
void TFT_Handler::start_draw() {
tft.startWrite();
}
void TFT_Handler::end_draw() {
tft.endWrite();
}
void TFT_Handler::draw_box(short int x, short int y, short int size_x, short int size_y, int color) {
tft.fillRect(x, y, size_x, size_y, color);
sprite.fillRect(x, y, size_x, size_y, color);
}
void TFT_Handler::draw_rect(short int x, short int y, short int size_x, short int size_y, short int thickness, int color) {
tft.drawRect(x, y, size_x, size_y, color);
sprite.drawRect(x, y, size_x, size_y, color);
}
void TFT_Handler::draw_line(short int x1, short int y1, short int x2, short int y2, int color) {
tft.drawLine(x1, y1, x2, y2, color);
sprite.drawLine(x1, y1, x2, y2, color);
}
void TFT_Handler::draw_text(short int x, short int y, const std::string& str, int color, short int size) {
tft.setTextColor(color);
tft.setTextSize(size);
tft.drawString(str.c_str(), x, y);
sprite.setTextColor(color);
sprite.setTextSize(size);
sprite.drawString(str.c_str(), x, y);
}
void TFT_Handler::fill_screen(int color) {
tft.fillScreen(color);
sprite.fillScreen(color);
}
void TFT_Handler::push_sprite() {

View File

@ -61,9 +61,6 @@ public:
void init(DISPLAY_STATE* display_state);
void start_draw();
void end_draw();
void draw_box(short int x, short int y, short int size_x, short int size_y, int color);
void draw_rect(short int x, short int y, short int size_x, short int size_y, short int thickness, int color);
void draw_line(short int x1, short int y1, short int x2, short int y2, int color);