45 : dc(display.getDisplay()), refreshInterval(1000 / refreshRate)
61 root->setBounds({{0, 0}, {dc.getWidth(), dc.getHeight()}});
63 if (screens.size() == 1)
74 uint8_t lastScreen = 0;
77 if (activeScreen != lastScreen)
79 lastScreen = activeScreen;
80 dc.clear(mxgui::black);
81 screens[activeScreen]->invalidateTree();
86 drawViewTree(screens[activeScreen], dc);
99 void drawViewTree(
View* root, mxgui::DrawingContext& dc)
102 std::deque<View*> viewsDc;
103 viewsDc.push_back(root);
105 while (viewsDc.size() != 0)
107 View* view = viewsDc.front();
112 for (
View* c : view->getChilds())
113 viewsDc.push_back(c);
117 mxgui::DrawingContext dc;
119 unsigned int refreshInterval;
121 NavController controller;
122 std::map<uint8_t, View*> screens;
124 uint8_t activeScreen = 0;
bool shouldStop()
Tells whether or not the ActiveObject should stop its execution.
virtual bool start()
Start the thread associated with this active object.
void onButtonEvent(ButtonEvent press)
void updateViewTree(View *root)
UI Thread: Manages multiple view trees ("Screen") and draws the active one at the provided refresh ra...
mxgui::DrawingContext & getDrawingContext()
void addScreen(uint8_t id, View *root)
void showScreen(uint8_t id)
ScreenManager(mxgui::DisplayManager &display, unsigned int refreshRate)
void onButtonEvent(ButtonEvent press)
Base class for anything that can be drawn on the screen and interacted with.
virtual void draw(mxgui::DrawingContext &dc)
Draw the view in its bounds.
void sleepUntil(long long absoluteTimeMs)
Sleep until a given time in milliseconds.
long long getOldTick()
Get the current time in milliseconds.
This file includes all the types the logdecoder script will decode.