wavelength 1.0.0
Loading...
Searching...
No Matches
UIManager Class Reference

Owner of every front-end screen, panel, and style, and of the screen that shows. More...

#include <uimanager.h>

Inheritance diagram for UIManager:
Collaboration diagram for UIManager:

Classes

class  Callback
 Callback that keeps a shared .rnd file from replacing loaded objects. More...

Public Types

typedef UIPanel *(* PanelFactory) (DataArray *pData, const char *pszDir)
 Routine that creates a panel from its script description.
typedef UIScreen *(* ScreenFactory) (DataArray *pData)
 Routine that creates a screen from its script description.
typedef UIStyle *(* StyleFactory) (DataArray *pData)
 Routine that creates a style from its script description.
typedef UIComponent *(* ComponentFactory) (DataArray *pData, const char *pszDir)
 Routine that creates a component from its script description.

Public Member Functions

 UIManager ()
 Construct an empty manager.
 ~UIManager () override
 Destroy the manager.
void Init ()
 Read the ui section of the configuration, load the shared .rnd files, and register the built-in panel, screen, style, and component types.
void Terminate ()
 Destroy every style, screen, panel, and shared object.
void AddScreen (UIScreen *pScreen)
 Register a screen under its name.
void AddPanel (UIPanel *pPanel)
 Register a panel under its name.
void AddStyle (UIStyle *pStyle)
 Register a style under its name.
bool IsNavigationMsg (Message *pMsg)
 Report whether a message is a controller button or a keyboard key.
bool DispatchPriv (Message *pMsg) override
 Track the directional buttons for the repeat.
 __attribute__ ((noinline)) bool HandleJoypad(JoypadInputMsg *pMsg)
 Start or stop the repeat of a directional button.
bool Dispatch (Message *pMsg) override
 Offer a message to the sinks, then to the manager, then to the current screen.
void Poll (float fTime)
 Advance the current screen to a time, and send the repeat of a held directional button.
void Draw ()
 Draw the current screen.
UIScreen * FindScreen (const char *pszName, bool bFail)
 Find a screen by name.
UIPanel * FindPanel (const char *pszName, bool bFail)
 Find a panel by name.
UIComponent * FindComponent (const char *pszPanel, const char *pszComponent, bool bFail)
 Find a component of a panel by name.
UIStyle * FindStyle (const char *pszName, bool bFail)
 Find a style by name.
void GotoScreen (const char *pszName)
 Change to the screen of a name.
void GotoScreen (UIScreen *pScreen)
 Change to a screen.
void SetCurrentScreen (UIScreen *pScreen)
 Record the current screen.
UIPanel * FocusPanel ()
 Report the panel with the focus on the current screen.
void LoadGroup (const char *pszGroup)
 Load the panels of every screen of a loading group.
void UnloadGroup (const char *pszGroup)
 Unload the panels of every screen of a loading group.
bool IsGroupLoaded (const char *pszGroup)
 Report whether every screen of a loading group has loaded.
void RegisterPanelType (PanelFactory pfnFactory, const char *pszType)
 Register a panel type.
void RegisterScreenType (ScreenFactory pfnFactory, const char *pszType)
 Register a screen type.
void RegisterStyleType (StyleFactory pfnFactory, const char *pszType)
 Register a style type.
void RegisterComponentType (ComponentFactory pfnFactory, const char *pszType)
 Register a component type.
UIPanel * CreatePanel (DataArray *pData, const char *pszDir)
 Create a panel through the factory registered for its entry type.
UIScreen * CreateScreen (DataArray *pData)
 Create a screen through the factory registered for its entry type.
UIStyle * CreateStyle (DataArray *pData)
 Create a style through the factory registered for its entry type.
UIComponent * CreateComponent (DataArray *pData, const char *pszDir)
 Create a component through the factory registered for its entry type.
void LoadFile (const char *pszFile, bool bLoadAll)
 Read a front-end description and create what it describes.
void VerifyGroup (const char **ppszGroup)
 Check a loading group against the allowable_groups of the configuration.
void ReportLocalizeErrors ()
 Report the localisation errors the panels recorded while their texts loaded.
UIScreen * GetCurrentScreen () const
float GetTime () const
int GetEditMode () const
Public Member Functions inherited from MsgSource
 MsgSource ()
 Construct a source with no sinks.
virtual ~MsgSource ()
 Release the list of sinks.
virtual void AddSink (MsgSink *pSink)
 Register a sink, ignoring a sink that is already registered.
virtual void RemoveSink (MsgSink *pSink)
 Unregister the first occurrence of a sink.
void Send (Message *pMsg)
 Deliver a message to every registered sink, in registration order.
bool SendUntilHandled (Message *pMsg)
 Deliver a message to the registered sinks in registration order until one handles it.
 MsgSource ()
 Create a source with no sinks.
virtual ~MsgSource ()
 Free the list of sinks.
virtual void AddSink (MsgSink *sink)
 Add a sink at the end of the list, unless it is already there.
virtual void RemoveSink (MsgSink *sink)
 Remove a sink, which must be in the list.
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the pool heaps under the tag "MsgSink".
void operator delete (void *pBlock)
 Return a sink to the pool heaps.
virtual ~MsgSink ()
void * operator new (size_t size)
 Allocate from the main heap under the name MsgSink.
void operator delete (void *mem)
 Return memory to its heap.
virtual ~MsgSink ()
 Destroy the sink.

Additional Inherited Members

Public Attributes inherited from MsgSource
int mGraphBuilt

Detailed Description

Owner of every front-end screen, panel, and style, and of the screen that shows.

The RTTI records the class as deriving from MsgSource and MsgSink, and includes the class name. The one instance is TheUI. Its MsgSource subobject sits at +0x00 and its MsgSink subobject at +0x10.

LoadFile() reads a front-end description and creates its styles, screens, and panels through the factories registered for their entry types. An entry whose type includes style, screen, or panel is one of those, in that order of precedence, and a focus entry goes to the screen it names. The metagame registers its screen and panel classes before it loads its description.

The manager routes front-end input. A message reaches its sinks until one handles it, then the current screen when the message is a controller button or a keyboard key. Directional buttons held down repeat, first after the longer delay and then after the shorter one.

Member Typedef Documentation

◆ PanelFactory

typedef UIPanel *(* UIManager::PanelFactory) (DataArray *pData, const char *pszDir)

Routine that creates a panel from its script description.

Parameters
pDataThe script description.
pszDirThe directory of the description file.
Returns
The new panel.

◆ ScreenFactory

typedef UIScreen *(* UIManager::ScreenFactory) (DataArray *pData)

Routine that creates a screen from its script description.

Parameters
pDataThe script description.
Returns
The new screen.

◆ StyleFactory

typedef UIStyle *(* UIManager::StyleFactory) (DataArray *pData)

Routine that creates a style from its script description.

Parameters
pDataThe script description.
Returns
The new style.

◆ ComponentFactory

typedef UIComponent *(* UIManager::ComponentFactory) (DataArray *pData, const char *pszDir)

Routine that creates a component from its script description.

Parameters
pDataThe script description.
pszDirThe name of the panel the component belongs to.
Returns
The new component.

Constructor & Destructor Documentation

◆ UIManager()

UIManager::UIManager ( )

Construct an empty manager.

Ghidra address:
NTSC-U/C: 0x0020c000
Ghidra address:
PAL: 0x00214e00

◆ ~UIManager()

UIManager::~UIManager ( )
override

Destroy the manager.

Ghidra address:
NTSC-U/C: 0x0020c3d0
Ghidra address:
PAL: 0x002151d0

Member Function Documentation

◆ Init()

void UIManager::Init ( )

Read the ui section of the configuration, load the shared .rnd files, and register the built-in panel, screen, style, and component types.

Ghidra address:
NTSC-U/C: 0x0020c668
Ghidra address:
PAL: 0x00215468

◆ Terminate()

void UIManager::Terminate ( )

Destroy every style, screen, panel, and shared object.

Ghidra address:
NTSC-U/C: 0x0020cb38
Ghidra address:
PAL: 0x00215938

◆ AddScreen()

void UIManager::AddScreen ( UIScreen * pScreen)

Register a screen under its name.

Parameters
pScreenThe screen.
Ghidra address:
NTSC-U/C: 0x0020cd90
Ghidra address:
PAL: 0x00215b90

◆ AddPanel()

void UIManager::AddPanel ( UIPanel * pPanel)

Register a panel under its name.

Parameters
pPanelThe panel.
Ghidra address:
NTSC-U/C: 0x0020ce90
Ghidra address:
PAL: 0x00215c90

◆ AddStyle()

void UIManager::AddStyle ( UIStyle * pStyle)

Register a style under its name.

Parameters
pStyleThe style.
Ghidra address:
NTSC-U/C: 0x0020cf90
Ghidra address:
PAL: 0x00215d90

◆ IsNavigationMsg()

bool UIManager::IsNavigationMsg ( Message * pMsg)

Report whether a message is a controller button or a keyboard key.

Parameters
pMsgThe message.
Returns
Whether the message is a JoypadInputMsg or a KeyboardKeyMsg.
Ghidra address:
NTSC-U/C: 0x0020d090
Ghidra address:
PAL: 0x00215e90

◆ DispatchPriv()

bool UIManager::DispatchPriv ( Message * pMsg)
overridevirtual

Track the directional buttons for the repeat.

Parameters
pMsgThe message.
Returns
False, for every message.
Ghidra address:
NTSC-U/C: 0x0020d110
Ghidra address:
PAL: 0x00215f28

Implements MsgSink.

◆ __attribute__()

UIManager::__attribute__ ( (noinline) )

Start or stop the repeat of a directional button.

Pressing a directional button starts its repeat unless another controller's repeat runs. Releasing the button that repeats stops the repeat.

Parameters
pMsgThe message of the button.
Returns
False.
Ghidra address:
NTSC-U/C: 0x0020d180
Ghidra address:
PAL: 0x00215f98

◆ Dispatch()

bool UIManager::Dispatch ( Message * pMsg)
overridevirtual

Offer a message to the sinks, then to the manager, then to the current screen.

Only a controller button or a keyboard key reaches the current screen, and only those skip the sinks.

Parameters
pMsgThe message.
Returns
Whether the message was handled.
Ghidra address:
NTSC-U/C: 0x0020d270
Ghidra address:
PAL: 0x00216088

Reimplemented from MsgSink.

◆ Poll()

void UIManager::Poll ( float fTime)

Advance the current screen to a time, and send the repeat of a held directional button.

Parameters
fTimeThe front-end time in milliseconds.
Ghidra address:
NTSC-U/C: 0x0020d320
Ghidra address:
PAL: 0x00216138

◆ Draw()

void UIManager::Draw ( )

Draw the current screen.

Ghidra address:
NTSC-U/C: 0x0020d448
Ghidra address:
PAL: 0x00216260

◆ FindScreen()

UIScreen * UIManager::FindScreen ( const char * pszName,
bool bFail )

Find a screen by name.

Parameters
pszNameThe name.
bFailTreat a missing screen as an error. The shipped build ignores it.
Returns
The screen, or null.
Ghidra address:
NTSC-U/C: 0x0020d480
Ghidra address:
PAL: 0x00216298

◆ FindPanel()

UIPanel * UIManager::FindPanel ( const char * pszName,
bool bFail )

Find a panel by name.

Parameters
pszNameThe name.
bFailTreat a missing panel as an error. The shipped build ignores it.
Returns
The panel, or null.
Ghidra address:
NTSC-U/C: 0x0020d540
Ghidra address:
PAL: 0x00216358

◆ FindComponent()

UIComponent * UIManager::FindComponent ( const char * pszPanel,
const char * pszComponent,
bool bFail )

Find a component of a panel by name.

Parameters
pszPanelThe name of the panel.
pszComponentThe name of the component.
bFailTreat a missing panel or component as an error. The shipped build ignores it.
Returns
The component, or null.
Ghidra address:
NTSC-U/C: 0x0020d600
Ghidra address:
PAL: 0x00216418

◆ FindStyle()

UIStyle * UIManager::FindStyle ( const char * pszName,
bool bFail )

Find a style by name.

Parameters
pszNameThe name.
bFailTreat a missing style as an error. The shipped build ignores it.
Returns
The style, or null.
Ghidra address:
NTSC-U/C: 0x0020d658
Ghidra address:
PAL: 0x00216470

◆ GotoScreen() [1/2]

void UIManager::GotoScreen ( const char * pszName)

Change to the screen of a name.

The routine looks the screen up in TheUI rather than in this manager.

Parameters
pszNameThe name.
Ghidra address:
NTSC-U/C: 0x0020d718
Ghidra address:
PAL: 0x00216530

◆ GotoScreen() [2/2]

void UIManager::GotoScreen ( UIScreen * pScreen)

Change to a screen.

Nothing happens when the screen is current or is the one the current screen exits to. The manager otherwise dispatches a UIScreenChangeMsg to itself, and a handler that reports it as handled cancels the change. The new screen loads its panels, and the current screen exits to it, or the new screen enters at once when no screen is current.

Parameters
pScreenThe screen.
Ghidra address:
NTSC-U/C: 0x0020d758
Ghidra address:
PAL: 0x00216570

◆ SetCurrentScreen()

void UIManager::SetCurrentScreen ( UIScreen * pScreen)

Record the current screen.

UIScreen::Enter() calls the routine.

Parameters
pScreenThe screen.
Ghidra address:
NTSC-U/C: 0x0020d848
Ghidra address:
PAL: 0x00216660

◆ FocusPanel()

UIPanel * UIManager::FocusPanel ( )

Report the panel with the focus on the current screen.

A screen must be current.

Returns
The panel, or null.
Ghidra address:
NTSC-U/C: 0x0020d858
Ghidra address:
PAL: 0x00216670

◆ LoadGroup()

void UIManager::LoadGroup ( const char * pszGroup)

Load the panels of every screen of a loading group.

Parameters
pszGroupThe group.
Ghidra address:
NTSC-U/C: 0x0020d868
Ghidra address:
PAL: 0x00216680

◆ UnloadGroup()

void UIManager::UnloadGroup ( const char * pszGroup)

Unload the panels of every screen of a loading group.

Parameters
pszGroupThe group.
Ghidra address:
NTSC-U/C: 0x0020d8f0
Ghidra address:
PAL: 0x00216708

◆ IsGroupLoaded()

bool UIManager::IsGroupLoaded ( const char * pszGroup)

Report whether every screen of a loading group has loaded.

Parameters
pszGroupThe group.
Returns
Whether the group is ready to show.
Ghidra address:
NTSC-U/C: 0x0020d978
Ghidra address:
PAL: 0x00216790

◆ RegisterPanelType()

void UIManager::RegisterPanelType ( PanelFactory pfnFactory,
const char * pszType )

Register a panel type.

Parameters
pfnFactoryThe routine that creates a panel of the type.
pszTypeThe entry type of the front-end description.
Ghidra address:
NTSC-U/C: 0x0020da10
Ghidra address:
PAL: 0x00216828

◆ RegisterScreenType()

void UIManager::RegisterScreenType ( ScreenFactory pfnFactory,
const char * pszType )

Register a screen type.

Parameters
pfnFactoryThe routine that creates a screen of the type.
pszTypeThe entry type of the front-end description.
Ghidra address:
NTSC-U/C: 0x0020db28
Ghidra address:
PAL: 0x00216940

◆ RegisterStyleType()

void UIManager::RegisterStyleType ( StyleFactory pfnFactory,
const char * pszType )

Register a style type.

Parameters
pfnFactoryThe routine that creates a style of the type.
pszTypeThe entry type of the front-end description.
Ghidra address:
NTSC-U/C: 0x0020dc40
Ghidra address:
PAL: 0x00216a58

◆ RegisterComponentType()

void UIManager::RegisterComponentType ( ComponentFactory pfnFactory,
const char * pszType )

Register a component type.

Parameters
pfnFactoryThe routine that creates a component of the type.
pszTypeThe entry type of a panel description.
Ghidra address:
NTSC-U/C: 0x0020dd58
Ghidra address:
PAL: 0x00216b70

◆ CreatePanel()

UIPanel * UIManager::CreatePanel ( DataArray * pData,
const char * pszDir )

Create a panel through the factory registered for its entry type.

The type must be registered.

Parameters
pDataThe script description. Index 0 is the type.
pszDirThe directory of the description file.
Returns
The new panel.
Ghidra address:
NTSC-U/C: 0x0020de70
Ghidra address:
PAL: 0x00216c88

◆ CreateScreen()

UIScreen * UIManager::CreateScreen ( DataArray * pData)

Create a screen through the factory registered for its entry type.

The type must be registered.

Parameters
pDataThe script description. Index 0 is the type.
Returns
The new screen.
Ghidra address:
NTSC-U/C: 0x0020df78
Ghidra address:
PAL: 0x00216d90

◆ CreateStyle()

UIStyle * UIManager::CreateStyle ( DataArray * pData)

Create a style through the factory registered for its entry type.

The type must be registered.

Parameters
pDataThe script description. Index 0 is the type.
Returns
The new style.
Ghidra address:
NTSC-U/C: 0x0020e078
Ghidra address:
PAL: 0x00216e90

◆ CreateComponent()

UIComponent * UIManager::CreateComponent ( DataArray * pData,
const char * pszDir )

Create a component through the factory registered for its entry type.

The type must be registered.

Parameters
pDataThe script description. Index 0 is the type.
pszDirThe name of the panel the component belongs to.
Returns
The new component.
Ghidra address:
NTSC-U/C: 0x0020e178
Ghidra address:
PAL: 0x00216f90

◆ LoadFile()

void UIManager::LoadFile ( const char * pszFile,
bool bLoadAll )

Read a front-end description and create what it describes.

Parameters
pszFileThe description file, or null to do nothing.
bLoadAllAlso load every screen at once, waiting for each to finish.
Ghidra address:
NTSC-U/C: 0x0020e280
Ghidra address:
PAL: 0x00217098

◆ VerifyGroup()

void UIManager::VerifyGroup ( const char ** ppszGroup)

Check a loading group against the allowable_groups of the configuration.

A null group becomes the first allowable group. A group the list does not include is reported.

Parameters
ppszGroupThe group, which may be replaced.
Ghidra address:
NTSC-U/C: 0x0020e4e8
Ghidra address:
PAL: 0x00217300

◆ ReportLocalizeErrors()

void UIManager::ReportLocalizeErrors ( )

Report the localisation errors the panels recorded while their texts loaded.

The body is with LocalizeErrors, the record it reports.

Ghidra address:
NTSC-U/C: 0x00209ca0
Ghidra address:
PAL: 0x00212aa0

◆ GetCurrentScreen()

UIScreen * UIManager::GetCurrentScreen ( ) const
inline
Returns
The screen that shows, or null.

◆ GetTime()

float UIManager::GetTime ( ) const
inline
Returns
The time the last Poll() received.

◆ GetEditMode()

int UIManager::GetEditMode ( ) const
inline
Returns
Whether the editmode setting of the configuration is on.

The documentation for this class was generated from the following file: