diff --git a/Desktop_Test/Desktop_Test.ino b/Desktop_Test/Desktop_Test.ino index 01658af..2c94481 100644 --- a/Desktop_Test/Desktop_Test.ino +++ b/Desktop_Test/Desktop_Test.ino @@ -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); } diff --git a/Desktop_Test/shell.cpp b/Desktop_Test/shell.cpp index 7b3665b..0f01ed6 100644 --- a/Desktop_Test/shell.cpp +++ b/Desktop_Test/shell.cpp @@ -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 ======= diff --git a/Desktop_Test/tft_handler.cpp b/Desktop_Test/tft_handler.cpp index 602e717..389f1dd 100644 --- a/Desktop_Test/tft_handler.cpp +++ b/Desktop_Test/tft_handler.cpp @@ -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() { diff --git a/Desktop_Test/tft_handler.h b/Desktop_Test/tft_handler.h index 4ebeb4c..328da10 100644 --- a/Desktop_Test/tft_handler.h +++ b/Desktop_Test/tft_handler.h @@ -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);