Launch AppLauncher at Boot

AppLauncher is PixelUI’s built-in application entry point. It is a regular App that derives from IconView, reads registered Apps from AppManager, and calls ViewManager::launch() after the user selects an icon.

AppLauncher interface

The default AppLauncher. AppLauncher itself is a standard App.

1. Register launchable Apps

Create a registration item for a regular App with AppItem::make<T>():

1
2
AppItem settingsApp =
AppItem::make<SettingsApp>("Settings", settings_icon_bits);

Explicitly add it to AppManager during startup. PixelUI does not use static automatic registration, so startup code controls both the timing and order:

1
2
3
4
5
6
void registerApps() {
auto& apps = AppManager::getInstance();
apps.registerApp(settingsApp);
apps.registerApp(aboutApp);
// ...
}

The registry capacity is set by PIXELUI_MAX_APP_NUM. Confirm that all entries fit before startup; see Resource limits for configuration details.

2. Launch the menu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "ui/AppLauncher/AppLauncher.h"

int main() {
init_display(u8g2);

registerApps();

ui.begin();

ViewManager& views = *ui.getViewManagerPtr();
const ViewManager::LaunchResult result = AppLauncher::launch(ui, views);
if (result != ViewManager::LaunchResult::Ok) {
// Log the error or enter a minimal fault screen.
platform_fatal("Cannot launch AppLauncher");
}

run_ui_loop();
}

The launcher normally sits at the bottom of the App stack. See App lifecycle and ViewManager for pause, resume, fade, and failure behavior.

最新文章
网站信息
文章数目 :
1
本站访客数 :
本站总浏览量 :
最后更新时间 :