![]() |
Cytopia
0.3
A city building simulation game
|
Draws the UI to the screen. More...
#include <UIManager.hxx>
Public Member Functions | |
void | init () |
Parses the UiLayout.json files and creates UI Elements. More... | |
struct ImFont * | loadFont (const std::string &name, uint32_t size) |
void | initializeImGuiFonts () |
void | loadSettings (json &uiLayout) |
void | parseLayouts (const json &uiLayout) |
void | drawUI () |
Renders all UI Widgets. More... | |
void | toggleDebugMenu () |
Toggle Visibility of Debug Menu. More... | |
void | setFPSCounterText (const std::string &fps) |
Helper function to update the FPS Counter. More... | |
std::unordered_map< std::string, LayoutData > & | getLayouts () |
Get the LayoutGroup container. More... | |
void | setTooltip (const std::string &tooltipText) |
void | clearTooltip () |
Hides and resets the active tooltip. More... | |
void | closeOpenMenus () |
Close all open menus but the build menu. More... | |
void | openMenu (GameMenu::Ptr menuOption) |
template<class Menu > | |
void | openMenu () |
void | closeMenu () |
bool | isAnyMenuOpen () const |
void | addPersistentMenu (GameMenu::Ptr menu) |
bool | isMouseHovered () const |
template<class Menu > | |
GameMenu::Ptr | findMenu () const |
template<class Menu > | |
void | addPersistentMenu () |
BUILDMENU_LAYOUT | buildMenuLayout () const |
void | setBuildMenuLayout (BUILDMENU_LAYOUT l) |
Public Attributes | |
friend | Singleton< UIManager > |
Private Member Functions | |
UIManager ()=default | |
~UIManager ()=default | |
Private Attributes | |
std::unordered_map< std::string, LayoutData > | m_layouts |
map holding layput groups, accessible via the layoutgroup ID More... | |
std::string | m_tooltip |
std::unordered_map< std::string, ImFont * > | m_loadedFonts |
std::vector< GameMenu::Ptr > | m_menuStack |
std::vector< GameMenu::Ptr > | m_persistentMenu |
bool | m_showDebugMenu = false |
visibility of the debug menu More... | |
std::string | m_fpsCounter |
bool | m_showFpsCounter = true |
struct ImFont * | fontDefault = nullptr |
pointer to the default font used for in-game text More... | |
BUILDMENU_LAYOUT | m_buildMenuLayout = BUILDMENU_LAYOUT::BOTTOM |
Additional Inherited Members | |
![]() | |
static UIManager & | instance (void) |
Get an instance of the singleton. More... | |
![]() | |
Singleton () noexcept=default | |
~Singleton () noexcept=default | |
Draws the UI to the screen.
Parses UiLayout.json file and instantiates UI widgets accordingly. Also takes care of layouting
Definition at line 39 of file UIManager.hxx.
|
privatedefault |
|
privatedefault |
|
inline |
Definition at line 126 of file UIManager.hxx.
void UIManager::addPersistentMenu | ( | GameMenu::Ptr | menu | ) |
Definition at line 174 of file UIManager.cxx.
|
inline |
Definition at line 128 of file UIManager.hxx.
void UIManager::clearTooltip | ( | ) |
Hides and resets the active tooltip.
Definition at line 224 of file UIManager.cxx.
void UIManager::closeMenu | ( | ) |
void UIManager::closeOpenMenus | ( | ) |
Close all open menus but the build menu.
Definition at line 144 of file UIManager.cxx.
void UIManager::drawUI | ( | ) |
Renders all UI Widgets.
Definition at line 184 of file UIManager.cxx.
|
inline |
Definition at line 105 of file UIManager.hxx.
|
inline |
Get the LayoutGroup container.
Returns the container that holds LayoutGroups
Definition at line 79 of file UIManager.hxx.
void UIManager::init | ( | ) |
Parses the UiLayout.json files and creates UI Elements.
void UIManager::initializeImGuiFonts | ( | ) |
Definition at line 69 of file UIManager.cxx.
|
inline |
Definition at line 99 of file UIManager.hxx.
bool UIManager::isMouseHovered | ( | ) | const |
Definition at line 182 of file UIManager.cxx.
ImFont * UIManager::loadFont | ( | const std::string & | name, |
uint32_t | size | ||
) |
void UIManager::loadSettings | ( | json & | uiLayout | ) |
Definition at line 84 of file UIManager.cxx.
|
inline |
Definition at line 96 of file UIManager.hxx.
void UIManager::openMenu | ( | GameMenu::Ptr | menuOption | ) |
Definition at line 152 of file UIManager.cxx.
void UIManager::parseLayouts | ( | const json & | uiLayout | ) |
Definition at line 94 of file UIManager.cxx.
|
inline |
Definition at line 129 of file UIManager.hxx.
void UIManager::setFPSCounterText | ( | const std::string & | fps | ) |
Helper function to update the FPS Counter.
fps |
Definition at line 142 of file UIManager.cxx.
void UIManager::setTooltip | ( | const std::string & | tooltipText | ) |
Definition at line 222 of file UIManager.cxx.
|
inline |
|
private |
pointer to the default font used for in-game text
Definition at line 151 of file UIManager.hxx.
|
private |
Definition at line 152 of file UIManager.hxx.
|
private |
Definition at line 147 of file UIManager.hxx.
|
private |
map holding layput groups, accessible via the layoutgroup ID
Definition at line 136 of file UIManager.hxx.
|
private |
Definition at line 140 of file UIManager.hxx.
|
private |
Definition at line 141 of file UIManager.hxx.
|
private |
Definition at line 142 of file UIManager.hxx.
|
private |
visibility of the debug menu
Definition at line 145 of file UIManager.hxx.
|
private |
Definition at line 148 of file UIManager.hxx.
|
private |
Definition at line 138 of file UIManager.hxx.
friend UIManager::Singleton< UIManager > |
Definition at line 42 of file UIManager.hxx.