22 for(
int i=0; i < MAX_BTN_LABELS; i++)
84 if(n >= MAX_BTN_LABELS)
return;
90 if(n >= MAX_BTN_LABELS)
return;
96 if(n >= MAX_BTN_LABELS)
return;
102 if(n >= MAX_BTN_LABELS)
return;
112 if(e) e->setState(s, c);
145 if(
state == STATE::SELECTED ||
state == STATE::HELD)
157 for(
int i=0; i < MAX_BTN_LABELS; i++) {
171 for(
int i=0; i < MAX_BTN_LABELS; i++) {
182 for(
int i=0; i<MAX_BTN_LABELS; i++)
185 label[i]->resetText();
193 if(
state == STATE::CLICKED ||
state == STATE::DISABLED || !controller)
198 auto pad = controller->getPadData();
199 int currentChan = controller->getChannel();
202 if(pad.validPointer && currentChan >= 0)
204 if(this->
isInside(pad.cursor_x, pad.cursor_y))
206 if(
state == STATE::DEFAULT)
208 this->
setState(STATE::SELECTED, currentChan);
211 platform->getInput()->setRumble(currentChan,
true);
243 for(
int i=0; i<MAX_TRIGGERS; i++)
249 if(
state == STATE::SELECTED)
251 if(!pad.validPointer || this->isInside(pad.cursor_x, pad.cursor_y))
253 this->
setState(STATE::CLICKED, currentChan);
258 else if(
trigger[i]->getType() == TRIGGER_TYPE::BUTTON_ONLY)
260 this->
setState(STATE::CLICKED, currentChan);
262 else if(
trigger[i]->getType() == TRIGGER_TYPE::BUTTON_ONLY_IN_FOCUS &&
265 this->
setState(STATE::CLICKED, currentChan);
276 for(
int i=0; i<MAX_TRIGGERS; i++)
281 if(
trigger[i]->isClicked(controller))
283 if(
trigger[i]->getType() == TRIGGER_TYPE::HELD &&
state == STATE::SELECTED &&
286 this->
setState(STATE::CLICKED, currentChan);
291 if(
trigger[i]->isHeld(controller))
293 if(
trigger[i]->getType() == TRIGGER_TYPE::HELD)
303 else if(held &&
state == STATE::CLICKED &&
stateChan == currentChan)
305 this->
setState(STATE::HELD, currentChan);
Umbrella header for the platform-agnostic libgui core.
bool isVisible()
Checks whether or not the element is visible.
int effectTarget
Effect target amount.
int effectAmount
Effect amount.
bool selectable
Whether or not this element selectable (can change to SELECTED state)
int stateChan
Which controller channel is responsible for the last change in state.
virtual void resetState()
Resets the element's state to STATE::DEFAULT.
int effectAmountOver
EffectAmount to set when wiimote cursor is over this element.
virtual void setState(STATE s, int c=-1)
Sets the element's state.
int effectsOver
Effects to enable when wiimote cursor is over this element.
UpdateCallback updateCB
Callback function to call when this element is updated.
int effects
Currently enabled effect(s).
int height
Element height.
bool holdable
Whether or not this element is holdable (can change to HELD state)
bool clickable
Whether or not this element is clickable (can change to CLICKED state)
bool isClickable()
Checks whether or not the element is clickable.
GuiElement * parentElement
Parent element.
bool isRumble()
Checks whether rumble was requested by the element.
void updateEffects()
Updates the element's effects (dynamic values) Called by Draw(), used for animation purposes.
GuiTrigger * trigger[MAX_TRIGGERS]
GuiTriggers (input actions) that this element responds to.
void setParent(GuiElement *e)
Set the element's parent.
int effectTargetOver
EffectTarget to set when wiimote cursor is over this element.
STATE state
Element state (DEFAULT, SELECTED, CLICKED, DISABLED)
bool isInside(int x, int y)
Checks whether the specified coordinates are within the element's boundaries.
bool isHoldable()
Checks whether or not the element is holdable.
Sound conversion and playback.
Display, manage, and manipulate text in the GUI.
STATE
Interaction state of a GuiElement (default, selected, clicked, held, disabled).