wavelength 1.0.0
Loading...
Searching...
No Matches
lrbutton.h
Go to the documentation of this file.
1#pragma once
2
4#include "rnd/rndmesh.h"
5#include "script/dataarray.h"
6#include "ui/uibutton.h"
7#include "ui/uistyle.h"
8
20class LRButton : public UIButton {
21public:
23 enum Arrow {
26 };
27
36 LRButton(DataArray *pData, const char *pszPanel);
37
44 ~LRButton() override;
45
57 static UIComponent *New(DataArray *pData, const char *pszPanel) {
58 return new LRButton(pData, pszPanel);
59 }
60
69 bool DispatchPriv(Message *pMsg) override;
70
78 void SetShowing(bool bShowing) override;
79
88 void SetState(int nState, bool bForce) override;
89
96 void Unfocus() override;
97
107 void Poll(float fTime) override;
108
123 void StartFlash(float fTime,
124 int nFlashes,
125 int nSelectedState,
126 int nNormalState,
127 float fSelectedMs,
128 float fNormalMs) override;
129
140 void SetArrowShowing(int nArrow, bool bShowing);
141
151
152private:
159 static int sArrowFlashes;
160
169 bool SetArrowState(int nState);
170
171 RndMesh *mLeftArrow;
172 RndMesh *mRightArrow;
173 int mArrowButton;
174 int mArrowFlashDone;
175 UIStyle *mArrowStyle;
176};
Reference-counted array of script data nodes.
Definition dataarray.h:20
Message the controller poll sends when a button is pressed or released.
Definition joypadinputmsg.h:23
bool HandleSelect(JoypadInputMsg *pMsg)
Choose the button with the cross button, or press an arrow with left or right.
void SetState(int nState, bool bForce) override
Change the state of the button and give both arrows the material of the arrow style.
void SetShowing(bool bShowing) override
Show or hide the button and both arrows.
void Unfocus() override
Stop a flash that runs and return to the state from before it.
Arrow
The arrows, the values SetArrowShowing() takes.
Definition lrbutton.h:23
@ kArrowLeft
Definition lrbutton.h:24
@ kArrowRight
Definition lrbutton.h:25
LRButton(DataArray *pData, const char *pszPanel)
Construct a button from its script description.
bool DispatchPriv(Message *pMsg) override
Handle a controller button, or pass any other message to UIComponent.
static UIComponent * New(DataArray *pData, const char *pszPanel)
Create a button from its script description.
Definition lrbutton.h:57
void SetArrowShowing(int nArrow, bool bShowing)
Show or hide one arrow.
void StartFlash(float fTime, int nFlashes, int nSelectedState, int nNormalState, float fSelectedMs, float fNormalMs) override
Start a flash between two states.
void Poll(float fTime) override
Advance the flashes of the button and of the pressed arrow to a time.
~LRButton() override
Destroy the button.
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Triangle mesh with a material.
Definition rndmesh.h:31
UIButton(DataArray *pData, const char *pszPanel)
Construct a button from its script description.
UIComponent(DataArray *pData)
Construct a showing component in the normal state.
Definition uicomponent.h:37
Material and font a component draws with in each of its states.
Definition uistyle.h:15