Standalone imp (#2791)

* Moved ui elements to common folder in standalone, and add screen parameters to the api v4

* pass it as a pointer, so if standalone app supports it can change
This commit is contained in:
Totoo 2025-09-16 20:29:05 +02:00 committed by GitHub
parent d80f41e9d7
commit 9afd3a9dca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 39 additions and 14 deletions

View file

@ -31,7 +31,9 @@ void initialize(const standalone_application_api_t& api) {
_api = &api;
context = new ui::Context();
standaloneViewMirror = new StandaloneViewMirror(*context, {0, 16, 240, 304});
screen_height = *(_api->screen_height);
screen_width = *(_api->screen_width);
standaloneViewMirror = new StandaloneViewMirror(*context, {0, 16, screen_width, screen_height - 16});
}
// event 1 == frame sync. called each 1/60th of second, so 6 = 100ms
@ -78,7 +80,7 @@ ui::Widget* captured_widget{nullptr};
void OnTouchEvent(int, int, uint32_t) {
if (standaloneViewMirror) {
_api->exit_app();
/*
/* //left here for example, but not used in digital rain
ui::TouchEvent event{{x, y}, static_cast<ui::TouchEvent::Type>(type)};
if (event.type == ui::TouchEvent::Type::Start) {
@ -105,7 +107,8 @@ bool OnKeyEvent(uint8_t) {
// ui::KeyEvent key = (ui::KeyEvent)key_val;
if (context) {
_api->exit_app();
/* auto focus_widget = context->focus_manager().focus_widget();
/* left here for example, but not used in digital rain
auto focus_widget = context->focus_manager().focus_widget();
if (focus_widget) {
if (focus_widget->on_key(key))
@ -130,6 +133,7 @@ bool OnEncoder(int32_t) {
if (context) {
_api->exit_app();
/*
left here for example, but not used in digital rain
auto focus_widget = context->focus_manager().focus_widget();
if (focus_widget) return focus_widget->on_encoder((ui::EncoderEvent)delta);
@ -143,6 +147,7 @@ bool OnKeyboad(uint8_t) {
if (context) {
_api->exit_app();
/*
left here for example, but not used in digital rain
auto focus_widget = context->focus_manager().focus_widget();
if (focus_widget)