643cbc3806
- Added POSIX desktop support for SDK builds, application packaging, and integration testing. - Added POSIX filesystem partitions and improved application path handling. - Added simulator support for loading and running applications dynamically. - Improved simulator task stack handling and display startup reliability. - Improved simulator display scaling, resizing, high-DPI support, and pointer accuracy. - Fixed LVGL timers and input polling on POSIX. (fixes simulator with Linux on some Intel graphics platforms) - Standardized data paths across platforms. - Logging now works via separate task: this allows apps to write to log without it affecting their stdout (for apps that output text as relevant date for other apps, like the File Selection app) - Fixes for app stdio
55 lines
1.4 KiB
C
55 lines
1.4 KiB
C
#include <app/event.h>
|
|
#include <app/manager.h>
|
|
#include <app/scheduler.h>
|
|
|
|
#include <lvgl_window_manager/window_manager.h>
|
|
|
|
#include <tactility/check.h>
|
|
|
|
#include <lvgl.h>
|
|
#include <lvgl/widgets/toolbar.h>
|
|
|
|
#include <greeting.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
static void create_widgets(lv_obj_t* parent, void* userData) {
|
|
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Title");
|
|
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
|
|
|
lv_obj_t* label = lv_label_create(parent);
|
|
lv_label_set_text(label, SDK_TEST_GREETING);
|
|
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
|
}
|
|
|
|
int main(int argc, char* argv[]) {
|
|
AppInstanceId app_instance_id = app_scheduler_current_app_id();
|
|
|
|
struct TaskEventGroup event_group = {0};
|
|
task_event_group_construct(&event_group);
|
|
|
|
struct AppEventSubscription sub = {0};
|
|
check(app_event_subscribe(&sub, &event_group) == ERROR_NONE);
|
|
|
|
WindowId window = window_manager_create(app_instance_id, create_widgets, NULL);
|
|
|
|
bool should_close = false;
|
|
while (!should_close) {
|
|
task_event_group_wait_any(&event_group, NULL, portMAX_DELAY);
|
|
|
|
struct AppEvent event;
|
|
while (app_event_poll(&sub, &event) == ERROR_NONE) {
|
|
if (event.type == APP_EVENT_CLOSE) {
|
|
should_close = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
window_manager_remove(window);
|
|
check(app_event_unsubscribe(&sub) == ERROR_NONE);
|
|
task_event_group_destruct(&event_group);
|
|
|
|
return 0;
|
|
}
|