#pragma once #include "app_manager.h" #include "canvas.h" #include "widgets.h" namespace roro { // Composes the frame (Status Bar, foreground App, Toast) off-screen and pushes it to the display. class Screen { public: bool begin(); // allocates the frame buffer (~32 KB at 8-bit colour) void render(AppManager& apps, const StatusInfo& status, const Toast* toast); // Takes over the screen while a Firmware Update is received or about to restart. void renderUpdate(const std::string& title, const std::string& detail, int percent); Canvas& canvas() { return canvas_; } private: Canvas canvas_; const App* lastApp_ = nullptr; // for an App that keeps what it drew (App::retainsContent) bool lost_ = true, overlayWas_ = false; }; } // namespace roro