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

Component the player chooses with the cross button. More...

#include <uibutton.h>

Inheritance diagram for UIButton:
Collaboration diagram for UIButton:

Public Member Functions

 UIButton (DataArray *pData, const char *pszPanel)
 Construct a button from its script description.
 ~UIButton () override
 Destroy the button.
bool DispatchPriv (Message *pMsg) override
 Handle a controller button, or pass any other message to UIComponent.
void SetShowing (bool bShowing) override
 Show or hide the button, its text, and its mesh.
const char * Text () const override
 Report the text of the text object.
void SetText (const char *pszText) override
 Replace the text of the text object.
void SetState (int nState, bool bForce) override
 Change the state and give the mesh and the text the material and the font the style lists for it.
void Unfocus () override
 Stop a flash that runs and return to the state from before it.
void Poll (float fTime) override
 Advance the flash to a time, and send the UIComponentSelectMsg once it ends.
void Print (PrnStream &stream) override
 Write the name, the visibility, the state, and the flash.
virtual void StartFlash (float fTime, int nFlashes, int nSelectedState, int nNormalState, float fSelectedMs, float fNormalMs)
 Start a flash between two states.
void SetStyle (UIStyle *pStyle)
 Replace the style and apply the current state again.
bool HandleSelect (JoypadInputMsg *pMsg)
 Start the flash when the cross button goes down.
UIStyle * GetStyle () const
Public Member Functions inherited from UIComponent
 UIComponent (DataArray *pData)
 Construct a showing component in the normal state.
bool Dispatch (Message *pMsg) override
 Offer a message to the focused panel of the current screen, then handle it here.
bool DispatchPriv (Message *pMsg) override
 Handle a message sent to the component.
virtual bool IsShowing () const
 Report whether the component is showing.
virtual int GetState () const
 Report the state the component shows.
virtual void Focus ()
 React to the panel giving the component the focus.
const char * GetName () const
int GetShowing () const
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.

Static Public Member Functions

static UIComponent * New (DataArray *pData, const char *pszPanel)
 Create a button from its script description.
Static Public Member Functions inherited from UIComponent
static void Init (DataArray *pConfig)
 Read the parameters of the flash a button shows when it is chosen.

Protected Attributes

int mFlashDone
float mFlashStart
float mFlashPeriod
float mSelectedMs
float mNormalMs
float mFlashEnd
int mNormalState
int mSelectedState
int mRevertState
RndMesh * mMesh
RndText * mText
UIStyle * mStyle
Protected Attributes inherited from UIComponent
const char * mName
int mShowing
int mState

Additional Inherited Members

Public Types inherited from UIComponent
enum  State { kStateNormal = 0 , kStateSelected = 1 , kStateDisabled = 2 }
 The state a component shows, the values of mState and the index UIStyle selects with. More...
Static Protected Attributes inherited from UIComponent
static int sNumFlashes
 Number of times a chosen button flashes before it reports the choice.
static float sSelectedMs
 Milliseconds of each flash a chosen button spends in the selected state.
static float sNormalMs
 Milliseconds of each flash a chosen button spends in the normal state.

Detailed Description

Component the player chooses with the cross button.

The RTTI records the class as deriving from UIComponent. The object is 0x40 bytes and its vtable is at 0x003d2390. The panel description provides the name at index 1, the style at index 2, and optionally the base of the object names at index 3, with the name standing in for a missing base. The button shows a mesh <panel>_<base>.mesh and a text object <panel>_<base>.txt, and its style selects the material of the mesh and the font of the text for each state.

Pressing the cross button sends a UIComponentSelectStartMsg. Unless a handler stops the choice, the button then flashes between the selected and the normal state, and sends a UIComponentSelectMsg once the flash ends.

Constructor & Destructor Documentation

◆ UIButton()

UIButton::UIButton ( DataArray * pData,
const char * pszPanel )

Construct a button from its script description.

Parameters
pDataThe script description.
pszPanelThe name of the panel the button belongs to.
Ghidra address:
NTSC-U/C: 0x002041c0
Ghidra address:
PAL: 0x0020cf78

◆ ~UIButton()

UIButton::~UIButton ( )
override

Destroy the button.

Ghidra address:
NTSC-U/C: 0x002043a8
Ghidra address:
PAL: 0x0020d160

Member Function Documentation

◆ New()

UIComponent * UIButton::New ( DataArray * pData,
const char * pszPanel )
inlinestatic

Create a button from its script description.

UIManager::Init() registers the routine for the component type button_comp.

Parameters
pDataThe script description.
pszPanelThe name of the panel the button belongs to.
Returns
The new button.
Ghidra address:
NTSC-U/C: 0x003774c0
Ghidra address:
PAL: 0x003e5bf0

◆ DispatchPriv()

bool UIButton::DispatchPriv ( Message * pMsg)
overridevirtual

Handle a controller button, or pass any other message to UIComponent.

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

Implements MsgSink.

◆ SetShowing()

void UIButton::SetShowing ( bool bShowing)
overridevirtual

Show or hide the button, its text, and its mesh.

Parameters
bShowingWhether the button shows.
Ghidra address:
NTSC-U/C: 0x00204478
Ghidra address:
PAL: 0x0020d230

Reimplemented from UIComponent.

◆ Text()

const char * UIButton::Text ( ) const
overridevirtual

Report the text of the text object.

The text object must exist.

Returns
The text as it was last set.
Ghidra address:
NTSC-U/C: 0x002043d8
Ghidra address:
PAL: 0x0020d190

Reimplemented from UIComponent.

◆ SetText()

void UIButton::SetText ( const char * pszText)
overridevirtual

Replace the text of the text object.

The text object must exist.

Parameters
pszTextThe text.
Ghidra address:
NTSC-U/C: 0x002043e8
Ghidra address:
PAL: 0x0020d1a0

Reimplemented from UIComponent.

◆ SetState()

void UIButton::SetState ( int nState,
bool bForce )
overridevirtual

Change the state and give the mesh and the text the material and the font the style lists for it.

Parameters
nStateOne of UIComponent::State.
bForceApply the state even when it does not change.
Ghidra address:
NTSC-U/C: 0x002044e8
Ghidra address:
PAL: 0x0020d2a0

Reimplemented from UIComponent.

◆ Unfocus()

void UIButton::Unfocus ( )
overridevirtual

Stop a flash that runs and return to the state from before it.

Ghidra address:
NTSC-U/C: 0x00204708
Ghidra address:
PAL: 0x0020d4c0

Reimplemented from UIComponent.

◆ Poll()

void UIButton::Poll ( float fTime)
overridevirtual

Advance the flash to a time, and send the UIComponentSelectMsg once it ends.

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

Reimplemented from UIComponent.

◆ Print()

void UIButton::Print ( PrnStream & stream)
overridevirtual

Write the name, the visibility, the state, and the flash.

Parameters
streamThe stream to write to.
Ghidra address:
NTSC-U/C: 0x00204938
Ghidra address:
PAL: 0x0020d6f0

Implements UIComponent.

◆ StartFlash()

virtual void UIButton::StartFlash ( float fTime,
int nFlashes,
int nSelectedState,
int nNormalState,
float fSelectedMs,
float fNormalMs )
virtual

Start a flash between two states.

The first selected phase is already over at fTime, and the flash ends after nFlashes periods and a last normal phase. The state from before the flash is restored when it ends.

Parameters
fTimeThe front-end time in milliseconds.
nFlashesThe number of flashes.
nSelectedStateThe state of the selected phase.
nNormalStateThe state of the normal phase.
fSelectedMsThe length of the selected phase.
fNormalMsThe length of the normal phase.
Ghidra address:
NTSC-U/C: 0x00204880
Ghidra address:
PAL: 0x0020d638

Reimplemented in LRButton.

◆ SetStyle()

void UIButton::SetStyle ( UIStyle * pStyle)

Replace the style and apply the current state again.

Parameters
pStyleThe style.
Ghidra address:
NTSC-U/C: 0x00204418
Ghidra address:
PAL: 0x0020d1d0

◆ HandleSelect()

bool UIButton::HandleSelect ( JoypadInputMsg * pMsg)

Start the flash when the cross button goes down.

Parameters
pMsgThe message of the button.
Returns
Whether the button handled the message.
Ghidra address:
NTSC-U/C: 0x00204600
Ghidra address:
PAL: 0x0020d3b8

◆ GetStyle()

UIStyle * UIButton::GetStyle ( ) const
inline
Returns
The style.

Member Data Documentation

◆ mFlashDone

int UIButton::mFlashDone
protected

Whether no flash runs.

◆ mFlashStart

float UIButton::mFlashStart
protected

The time the first flash period started.

◆ mFlashPeriod

float UIButton::mFlashPeriod
protected

The length of one selected and one normal phase.

◆ mSelectedMs

float UIButton::mSelectedMs
protected

The length of the selected phase.

◆ mNormalMs

float UIButton::mNormalMs
protected

The length of the normal phase.

◆ mFlashEnd

float UIButton::mFlashEnd
protected

The time the flash ends.

◆ mNormalState

int UIButton::mNormalState
protected

The state of the normal phase.

◆ mSelectedState

int UIButton::mSelectedState
protected

The state of the selected phase.

◆ mRevertState

int UIButton::mRevertState
protected

The state to restore when the flash ends.

◆ mMesh

RndMesh* UIButton::mMesh
protected

The mesh, or null when the file has no mesh of that name.

◆ mText

RndText* UIButton::mText
protected

The text object, or null when the file has no text object of that name.

◆ mStyle

UIStyle* UIButton::mStyle
protected

The style.


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