Everything works as intended. No flicker anymore
This commit is contained in:
parent
9206972133
commit
c90425cc6e
@ -78,6 +78,7 @@ void loop() {
|
|||||||
if (_display_state->update_display.load()) {
|
if (_display_state->update_display.load()) {
|
||||||
_shell->draw_all();
|
_shell->draw_all();
|
||||||
im->draw_button();
|
im->draw_button();
|
||||||
|
th->push_sprite();
|
||||||
_display_state->update_display.store(false);
|
_display_state->update_display.store(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -174,8 +174,6 @@ void Shell::minimize_window(short int window_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Shell::draw_all() {
|
void Shell::draw_all() {
|
||||||
tft->start_draw();
|
|
||||||
|
|
||||||
draw_background(0x0410);
|
draw_background(0x0410);
|
||||||
draw_task_bar(0xbdf7);
|
draw_task_bar(0xbdf7);
|
||||||
|
|
||||||
@ -186,7 +184,6 @@ void Shell::draw_all() {
|
|||||||
for (const auto& win : windows) {
|
for (const auto& win : windows) {
|
||||||
if (!win->minimized) draw_window(*win);
|
if (!win->minimized) draw_window(*win);
|
||||||
}
|
}
|
||||||
tft->end_draw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shell::draw_window(const Window& window) {
|
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) {
|
for (WindowContentText text : window.window_content_text) {
|
||||||
tft->draw_text(text.x, text.y, text.text, COL_BLACK, text.size);
|
tft->draw_text(text.x, text.y, text.text, COL_BLACK, text.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
tft->push_sprite();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ======= Desktop =======
|
// ======= Desktop =======
|
||||||
|
|||||||
@ -14,34 +14,26 @@ void TFT_Handler::init(DISPLAY_STATE* display_state) {
|
|||||||
sprite.createSprite(480, 320);
|
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) {
|
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) {
|
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) {
|
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) {
|
void TFT_Handler::draw_text(short int x, short int y, const std::string& str, int color, short int size) {
|
||||||
tft.setTextColor(color);
|
sprite.setTextColor(color);
|
||||||
tft.setTextSize(size);
|
sprite.setTextSize(size);
|
||||||
tft.drawString(str.c_str(), x, y);
|
sprite.drawString(str.c_str(), x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_Handler::fill_screen(int color) {
|
void TFT_Handler::fill_screen(int color) {
|
||||||
tft.fillScreen(color);
|
sprite.fillScreen(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_Handler::push_sprite() {
|
void TFT_Handler::push_sprite() {
|
||||||
|
|||||||
@ -61,9 +61,6 @@ public:
|
|||||||
|
|
||||||
void init(DISPLAY_STATE* display_state);
|
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_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_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);
|
void draw_line(short int x1, short int y1, short int x2, short int y2, int color);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user