10#include <aegis/system.hpp>
26class UISystem :
public ae::SystemRouter<UISystem,
27 Event::ConfigureUIScreen,
28 Event::ConfigureUIMenu,
32 Event::HideAllScreens,
35 Event::ResetUIResources>,
36 public ae::Singleton<UISystem>
44 void update(ae::q20_12_t )
override;
219 std::array<UIScreen*, 3>
loadedSub{
nullptr,
nullptr,
nullptr};
Generic events used across multiple systems.
Orchestrates rendering text from a bitmap.
Manager for hardware specific rendering functions related to the UI.
UIScreen * pendingScreen
screen requested by ShowScreen, applied at the start of the next update
void cancelSFX()
Stops playing the current sound effect, if any.
void shutdown() override
Unloads and cleans up all registered screens. Wrapper for cleanup.
std::array< UIScreen *, 2 > loadedMain
void applyPendingScreen()
Loads (if needed) and displays the pending screen, then clears it.
void resetUIResources()
Cleans up UISystem related resources.
std::array< int, 3 > hwBgSub
original background ids (order doesn't change)
std::array< int, 3 > lruBgSub
background ids. The order of the arrays matter. Front = least recently updated, back = last updated
int screenMainCount
currently loaded screens (max 3 sub, 2 main)
std::array< UIMenu *, 10 > menus
std::array< int, 2 > lruBgMain
std::array< UIScreen *, 3 > loadedSub
void hideAllScreens()
hides all screens.
void on_receive_unknown(const etl::imessage &msg)
Fallback handler for unhandled ETL messages.
void lruUpdate(int id, bool isMain)
Updates the order of lruBgSub/lruBgMain for the "least recently updated" id.
void update(ae::q20_12_t) override
Performs menu navigation logic.
void setSFXComponent(SFXComponent *sfx)
void on_receive(const Event::SwitchView &msg)
void cleanupMenus()
Unloads and cleans up all registered menus. Used to reset previous configs.
void cleanupScreens()
Unloads and cleans up all registered screens. Used to reset previous configs.
void registerScreen(UIScreen *screen)
Registers screens to UISystem to have them pre-loaded before calling show.
std::array< int, 2 > hwBgMain
Holds routerIDs used for systems.
constexpr etl::message_router_id_t kUISystemRouterID
Event to trigger hiding all UIScreens.
Event to trigger rendering UI text.
Event payload to release resources owned by the current view.
Event to show specified screen.
Event payload to switch the ViewState.