This helps with creation and getting values and should be safe since it still keeps lvgl on one thread at a time. Add OnLvglEvent to UIElement that allows foreasy place for UI Elements to respond to LVGL events . Add button class that can react to being presssed via a callback function. Add GetBottom() api to allow easy grabbing of bottom Y coordinate. use some new stuff in the settings page to sort test it all out.
18 lines
No EOL
527 B
C++
18 lines
No EOL
527 B
C++
#include "BasicUI.hpp"
|
|
#include "HomeScreen.hpp"
|
|
#include "ScreenManager.hpp"
|
|
|
|
using namespace UI;
|
|
|
|
BasicUI::BasicUI(std::shared_ptr<HardwareAbstract> aHardware)
|
|
: UIBase(aHardware) {
|
|
|
|
aHardware->keys()->RegisterKeyPressHandler([](auto aKeyEvent) {
|
|
return Screen::Manager::getInstance().distributeKeyEvent(aKeyEvent);
|
|
// Could potentially add a check here and display that a key event was
|
|
// unused.
|
|
});
|
|
|
|
Screen::Manager::getInstance().pushScreen(
|
|
std::make_unique<Screen::HomeScreen>(aHardware));
|
|
} |