This commit is contained in:
Rasmus Rasmussen 2025-12-15 20:45:05 +01:00
parent 987fb1cde9
commit 6a77bacb7e
6 changed files with 19 additions and 25 deletions

View File

@ -47,22 +47,14 @@ void setup() {
wm->init(th, _display_state); wm->init(th, _display_state);
// Create input task on Core 0 // Create input task on Core 0
xTaskCreatePinnedToCore( xTaskCreatePinnedToCore(input_task, "input_task", 4096, NULL, 1, &InputTask, 0);
input_task,
"input_task",
4096,
NULL,
1,
&InputTask,
0
);
delay(100); delay(100);
// Create test windows // Create test windows
Window win1 = { Window win1 = {
.id = 0, .id = 0,
.x = 10, .x = 170,
.y = 30, .y = 30,
.width = 350, .width = 350,
.height = 250, .height = 250,
@ -77,7 +69,7 @@ void setup() {
Window win2 = { Window win2 = {
.id = 1, .id = 1,
.x = 30, .x = 30,
.y = 50, .y = 150,
.width = 350, .width = 350,
.height = 270, .height = 270,
.background_color = 0xbdf7, .background_color = 0xbdf7,

View File

@ -7,11 +7,6 @@ enum CLICK_EVENTS {
RIGHT_CLICK = 2, RIGHT_CLICK = 2,
}; };
enum REDRAW_EVENT {
DESKTOP = 0,
WINDOWS = 1,
};
struct CLICK_EVENT { struct CLICK_EVENT {
int x; int x;
int y; int y;

View File

@ -1,15 +1,7 @@
#include "event_manager.h" #include "event_manager.h"
void EventManager::init() { void EventManager::init() {
xTaskCreatePinnedToCore( xTaskCreatePinnedToCore(dispatch_task, "event_dispatch", 4096, this, 2, &_dispatcher_task, 0);
dispatch_task,
"event_dispatch",
4096,
this,
2, // Higher priority than input
&_dispatcher_task,
0
);
} }
void EventManager::publish(const CLICK_EVENT& event) { void EventManager::publish(const CLICK_EVENT& event) {

View File

View File

@ -0,0 +1,9 @@
#pragma once
class SystemManager {
private:
public:
void init();
};

View File

@ -10,6 +10,12 @@ void WindowManager::init(TFT_Handler* th, DISPLAY_STATE* ds) {
} }
void WindowManager::create_window(Window window) { void WindowManager::create_window(Window window) {
int total_pos_x = window.x + window.width;
int total_pos_y = window.y + window.height;
if (total_pos_x > 480) window.x = total_pos_x - 480;
if (total_pos_y > 320) window.y = total_pos_y - 320;
windows.push_back(window); windows.push_back(window);
display_state->update_display.store(true); display_state->update_display.store(true);
} }