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

Button with a left and a right arrow that the directional buttons press. More...

#include <lrbutton.h>

Inheritance diagram for LRButton:
Collaboration diagram for LRButton:

Public Types

enum  Arrow { kArrowLeft = 0 , kArrowRight = 1 }
 The arrows, the values SetArrowShowing() takes. More...
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...

Public Member Functions

 LRButton (DataArray *pData, const char *pszPanel)
 Construct a button from its script description.
 ~LRButton () 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 and both arrows.
void SetState (int nState, bool bForce) override
 Change the state of the button and give both arrows the material of the arrow style.
void Unfocus () override
 Stop a flash that runs and return to the state from before it.
void Poll (float fTime) override
 Advance the flashes of the button and of the pressed arrow to a time.
void StartFlash (float fTime, int nFlashes, int nSelectedState, int nNormalState, float fSelectedMs, float fNormalMs) override
 Start a flash between two states.
void SetArrowShowing (int nArrow, bool bShowing)
 Show or hide one arrow.
bool HandleSelect (JoypadInputMsg *pMsg)
 Choose the button with the cross button, or press an arrow with left or right.
Public Member Functions inherited from UIButton
 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.
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 UIButton
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.

Additional Inherited Members

Protected Attributes inherited from UIButton
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
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

Button with a left and a right arrow that the directional buttons press.

The RTTI records the class as deriving from UIButton. The object is 0x54 bytes and its vtable is at 0x003d2310. Beyond the button's own description, index 3 is the base of the object names, which must be present, and index 4 is the style of the arrows. The arrows are the meshes <panel>_<base>_left.mesh and <panel>_<base>_right.mesh.

Pressing left or right on a button with that arrow sends a UIComponentSelectStartMsg, flashes the arrow once, and then sends a UIComponentSelectMsg. The button itself does not flash.

Member Enumeration Documentation

◆ Arrow

The arrows, the values SetArrowShowing() takes.

Enumerator
kArrowLeft 

The left arrow.

kArrowRight 

The right arrow.

Constructor & Destructor Documentation

◆ LRButton()

LRButton::LRButton ( 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: 0x00204b98
Ghidra address:
PAL: 0x0020d950

◆ ~LRButton()

LRButton::~LRButton ( )
override

Destroy the button.

Ghidra address:
NTSC-U/C: 0x00204d48
Ghidra address:
PAL: 0x0020db00

Member Function Documentation

◆ New()

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

Create a button from its script description.

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

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

◆ DispatchPriv()

bool LRButton::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: 0x00205178
Ghidra address:
PAL: 0x0020df30

Implements MsgSink.

◆ SetShowing()

void LRButton::SetShowing ( bool bShowing)
overridevirtual

Show or hide the button and both arrows.

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

Reimplemented from UIComponent.

◆ SetState()

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

Change the state of the button and give both arrows the material of the arrow style.

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

Reimplemented from UIComponent.

◆ Unfocus()

void LRButton::Unfocus ( )
overridevirtual

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

Ghidra address:
NTSC-U/C: 0x00204e70
Ghidra address:
PAL: 0x0020dc28

Reimplemented from UIComponent.

◆ Poll()

void LRButton::Poll ( float fTime)
overridevirtual

Advance the flashes of the button and of the pressed arrow to a time.

Once the arrow's flash ends, the button sends a UIComponentSelectMsg.

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

Reimplemented from UIComponent.

◆ StartFlash()

void LRButton::StartFlash ( float fTime,
int nFlashes,
int nSelectedState,
int nNormalState,
float fSelectedMs,
float fNormalMs )
overridevirtual

Start a flash between two states.

The override does nothing beyond UIButton::StartFlash().

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: 0x00204da0
Ghidra address:
PAL: 0x0020db58

Reimplemented from UIButton.

◆ SetArrowShowing()

void LRButton::SetArrowShowing ( int nArrow,
bool bShowing )

Show or hide one arrow.

The arrow must exist.

Parameters
nArrowOne of Arrow.
bShowingWhether the arrow shows.
Ghidra address:
NTSC-U/C: 0x00205118
Ghidra address:
PAL: 0x0020ded0

◆ HandleSelect()

bool LRButton::HandleSelect ( JoypadInputMsg * pMsg)

Choose the button with the cross button, or press an arrow with left or right.

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

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