HomeWildfire Games

# Restructured GUI implementation

Description

Restructured GUI implementation

CGUI now represents a single 'page'. CGUIManager maintains multiple pages and switches between them.
Split the XML files into pregame, loading, session and messagebox pages.
Added hotloading of GUI pages.
Minor GUI cleanups.
(Merge from hg 81862d33780c)

Details

Committed
philipDec 3 2009, 9:17 PM
Parents
rP7213: (Dummy change to help hgsvn)
Branches
Unknown
Tags
Unknown

Event Timeline

elexis added a subscriber: elexis.Dec 15 2018, 12:02 PM
elexis added inline comments.
/ps/trunk/source/gui/GUIManager.cpp
164

This function is problematic, as the calling JS function always intends to have this function run on the GUI page that defines the function, not the topmost GUI page.

For example when the onTick function of every GUI page in the stack is called, the GetGUIObjectByName relates to a GUI page that isn't topmost. rP7769 added something which looks like a quick workaround.

A second example is added in rP19846 (every GUI page in the stack calls the WindowResized event).

A third example occurs if we want a parent GUI page to call a function in the child GUI page (rP18078). The function of the child GUI page is called correctly, only this function will operate on the parent GUI page rather than the topmost page.

Since the objects are part of objects (GUIPages) rather than being part of one global object (Engine),
an object-oriented approach, i.e. GUIPage.GetGUIObjectByName over Engine.GetGUIObjectByName would solve this issue without adding a workaround that always fails for the next best use case.
This now however would mean replacing 778 JS calls now.

I think it is against the design of the GUI that a GUIPage could access GUIObejcts of a different page, so perhaps it perpetuating the workaround is the more pragmatic alternative.