![]() |
Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
External interface to the GUI system. More...
#include <GUIManager.h>

Classes | |
| struct | InputHandler |
| class | PageStackType |
| The page stack must not move pointers on push/pop, or pushing a page in a page's init method may crash (as the pusher page will suddenly have moved, and the stack will be confused). More... | |
| struct | SGUIPage |
Public Member Functions | |
| CGUIManager (Script::Context &scriptContext, Script::Interface &scriptInterface) | |
| ~CGUIManager () | |
| Script::Interface & | GetScriptInterface () |
| Script::Context & | GetContext () |
| std::shared_ptr< CGUI > | GetActiveGUI () |
| size_t | GetPageCount () const |
| Returns the number of currently open GUI pages. More... | |
| void | SwitchPage (const CStrW &name, const Script::Interface *srcScriptInterface, JS::HandleValue initData) |
| Load a new GUI page and make it active. More... | |
| JS::Value | OpenChildPage (const CStrW &pageName, Script::StructuredClone initData) |
| Load a new GUI page and make it active. More... | |
| Status | ReloadChangedFile (const VfsPath &path) |
| Called when a file has been modified, to hotload changes. More... | |
| Status | ReloadAllPages () |
| Called when we should reload all pages (e.g. More... | |
| Input::Reaction | HandleEvent (const SDL_Event &ev) |
| Pass input events to the currently active GUI page. More... | |
| void | SendEventToAll (const CStr &eventName, std::optional< JS::HandleValueArray > paramData=std::nullopt) const |
| See CGUI::SendEventToAll; applies to the currently active page. More... | |
| std::optional< bool > | TickObjects () |
| See CGUI::TickObjects; applies to all loaded pages. More... | |
| void | Draw (CCanvas2D &canvas) const |
| See CGUI::Draw; applies to all loaded pages. More... | |
| void | UpdateResolution () |
| See CGUI::UpdateResolution; applies to all loaded pages. More... | |
| bool | TemplateExists (const std::string &templateName) const |
| Check if a template with this name exists. More... | |
| const CParamNode & | GetTemplate (const std::string &templateName) |
| Retrieve the requested template, used for displaying faction specificities. More... | |
| void | DisplayLoadProgress (int percent, const wchar_t *pending_task) |
| Display progress / description in loading screen. More... | |
Private Member Functions | |
| NONCOPYABLE (CGUIManager) | |
| std::shared_ptr< CGUI > | top () const |
| PS::StaticVector< SGUIPage, 16 > | GetCopyOfFrozenStack () const |
| Returns an immutable copy so iterators aren't invalidated by handlers. More... | |
Private Attributes | |
| Script::Context & | m_ScriptContext |
| Script::Interface & | m_ScriptInterface |
| PageStackType | m_PageStack |
| CTemplateLoader | m_TemplateLoader |
| Input::Handler< InputHandler > | m_InputHandler |
External interface to the GUI system.
The GUI consists of a set of pages. Each page is constructed from a series of XML files, and is independent from any other page. Only one page is active at a time. All events and render requests etc will go to the active page. This lets the GUI switch between pre-game menu and in-game UI.
| CGUIManager::CGUIManager | ( | Script::Context & | scriptContext, |
| Script::Interface & | scriptInterface | ||
| ) |
| CGUIManager::~CGUIManager | ( | ) |
| void CGUIManager::DisplayLoadProgress | ( | int | percent, |
| const wchar_t * | pending_task | ||
| ) |
Display progress / description in loading screen.
| void CGUIManager::Draw | ( | CCanvas2D & | canvas | ) | const |
See CGUI::Draw; applies to all loaded pages.
|
inline |
|
inline |
|
private |
Returns an immutable copy so iterators aren't invalidated by handlers.
| size_t CGUIManager::GetPageCount | ( | ) | const |
Returns the number of currently open GUI pages.
|
inline |
| const CParamNode & CGUIManager::GetTemplate | ( | const std::string & | templateName | ) |
Retrieve the requested template, used for displaying faction specificities.
| Input::Reaction CGUIManager::HandleEvent | ( | const SDL_Event & | ev | ) |
Pass input events to the currently active GUI page.
|
private |
| JS::Value CGUIManager::OpenChildPage | ( | const CStrW & | pageName, |
| Script::StructuredClone | initData | ||
| ) |
Load a new GUI page and make it active.
All current pages will be retained, and will still be drawn and receive tick events, but will not receive user inputs. The returned promise will be fulfilled once the pushed page is closed.
| Status CGUIManager::ReloadAllPages | ( | ) |
Called when we should reload all pages (e.g.
translation hotloading update).
Called when a file has been modified, to hotload changes.
| void CGUIManager::SendEventToAll | ( | const CStr & | eventName, |
| std::optional< JS::HandleValueArray > | paramData = std::nullopt |
||
| ) | const |
See CGUI::SendEventToAll; applies to the currently active page.
| void CGUIManager::SwitchPage | ( | const CStrW & | name, |
| const Script::Interface * | srcScriptInterface, | ||
| JS::HandleValue | initData | ||
| ) |
Load a new GUI page and make it active.
All current pages will be destroyed.
| bool CGUIManager::TemplateExists | ( | const std::string & | templateName | ) | const |
Check if a template with this name exists.
| std::optional< bool > CGUIManager::TickObjects | ( | ) |
See CGUI::TickObjects; applies to all loaded pages.
When the root page is closed it's returned wheter Atlas should be started.
|
private |
| void CGUIManager::UpdateResolution | ( | ) |
See CGUI::UpdateResolution; applies to all loaded pages.
|
private |
|
private |
|
private |
|
private |
|
private |