Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
External interface to the GUI system. More...
#include <GUIManager.h>
Classes | |
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 (ScriptContext &scriptContext, ScriptInterface &scriptInterface) | |
~CGUIManager () | |
ScriptInterface & | GetScriptInterface () |
ScriptContext & | 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 ScriptInterface *srcScriptInterface, JS::HandleValue initData) |
Load a new GUI page and make it active. More... | |
JS::Value | PushPage (const CStrW &pageName, Script::StructuredClone initData) |
Load a new GUI page and make it active. More... | |
void | PopPage (Script::StructuredClone args) |
Unload the currently active GUI page, and make the previous page 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... | |
InReaction | HandleEvent (const SDL_Event_ *ev) |
Pass input events to the currently active GUI page. More... | |
void | SendEventToAll (const CStr &eventName) const |
See CGUI::SendEventToAll; applies to the currently active page. More... | |
void | SendEventToAll (const CStr &eventName, JS::HandleValueArray paramData) const |
void | 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 |
Private Attributes | |
ScriptContext & | m_ScriptContext |
ScriptInterface & | m_ScriptInterface |
PageStackType | m_PageStack |
CTemplateLoader | m_TemplateLoader |
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 | ( | ScriptContext & | scriptContext, |
ScriptInterface & | 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 |
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.
InReaction CGUIManager::HandleEvent | ( | const SDL_Event_ * | ev | ) |
Pass input events to the currently active GUI page.
|
private |
void CGUIManager::PopPage | ( | Script::StructuredClone | args | ) |
Unload the currently active GUI page, and make the previous page active.
(There must be at least two pages when you call this.)
JS::Value CGUIManager::PushPage | ( | 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 | ) | const |
See CGUI::SendEventToAll; applies to the currently active page.
void CGUIManager::SendEventToAll | ( | const CStr & | eventName, |
JS::HandleValueArray | paramData | ||
) | const |
void CGUIManager::SwitchPage | ( | const CStrW & | name, |
const ScriptInterface * | 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.
void CGUIManager::TickObjects | ( | ) |
See CGUI::TickObjects; applies to all loaded pages.
|
private |
void CGUIManager::UpdateResolution | ( | ) |
See CGUI::UpdateResolution; applies to all loaded pages.
|
private |
|
private |
|
private |
|
private |