diff --git a/Desktop_Test/example_programs.h b/Desktop_Test/example_programs.h index 73aa24e..14ba42b 100644 --- a/Desktop_Test/example_programs.h +++ b/Desktop_Test/example_programs.h @@ -12,6 +12,13 @@ private: public: void run() override { Serial.println("Counter program started!"); + + WindowContentText text; + + text.x = _window->x + 10; + text.y = _window->y + 50; + + _window->window_content_text.push_back(text); while (_running) { counter++; @@ -19,9 +26,15 @@ public: // You can modify the window title if (_window) { - _window->title = "Counter: " + std::to_string(counter); - if (!_window->minimized) + if (!_window->minimized) { + _window->title = "Counter: " + std::to_string(counter); + + for (int i = 0; i < _window->window_content_text.size(); i++) { + _window->window_content_text[i].text = std::to_string(counter); + } + _display_state->update_display.store(true); + } } vTaskDelay(pdMS_TO_TICKS(1000)); diff --git a/Desktop_Test/program.h b/Desktop_Test/program.h index 4dc6e40..840c09e 100644 --- a/Desktop_Test/program.h +++ b/Desktop_Test/program.h @@ -46,6 +46,12 @@ struct WindowDecoration { WindowAction action; }; +struct WindowContentText { + int x; + int y; + std::string text; +}; + struct Window { int id; int x; @@ -58,6 +64,7 @@ struct Window { bool minimized; std::string title; std::vector window_decorations; + std::vector window_content_text; }; // Base Program class - all programs inherit from this diff --git a/Desktop_Test/program_registry.cpp b/Desktop_Test/program_registry.cpp deleted file mode 100644 index 91c5ac0..0000000 --- a/Desktop_Test/program_registry.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "program_registry.h" -#include - -void InstalledProgram::do_stuff() { - Serial.println("lol"); -} - -void InstalledProgram::do_some_other_stuff() { - Serial.println("ASDDSAASDASD"); -} - -void InstalledProgram::lol() { - Serial.println("ffffrf"); -} - -void InstalledProgram::omagelol() { - Serial.println("11111"); -} - -void InstalledProgram::sheeesh() { - Serial.println("44444"); -} \ No newline at end of file diff --git a/Desktop_Test/program_registry.h b/Desktop_Test/program_registry.h deleted file mode 100644 index 68d22d2..0000000 --- a/Desktop_Test/program_registry.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -struct InstalledProgram { - void do_stuff(); - void do_some_other_stuff(); - void lol(); - void omagelol(); - void sheeesh(); -}; \ No newline at end of file diff --git a/Desktop_Test/shell.cpp b/Desktop_Test/shell.cpp index e8bb192..b266133 100644 --- a/Desktop_Test/shell.cpp +++ b/Desktop_Test/shell.cpp @@ -224,6 +224,10 @@ void Shell::draw_window(Window window) { // Window content tft->draw_box(window.x + 3, window.y + 35, window.width - 6, window.height - 38, COL_WHITE); + + for (WindowContentText text : window.window_content_text) { + tft->draw_text(text.x, text.y, text.text, COL_BLACK); + } } // ======= Desktop ======= @@ -368,6 +372,7 @@ int Shell::handle_desktop_click(CLICK_EVENT event) { win->focused = true; win->minimized = false; win->title = item.name; + win->window_content_text = {}; // Spawn program using the program_class bool result = _system_manager->spawn_program(win, item.program_class);