13typedef void (*UpdateCallback)(
void * e);
47 SLIDE_TOP = (1u << 0),
48 SLIDE_BOTTOM = (1u << 1),
49 SLIDE_RIGHT = (1u << 2),
50 SLIDE_LEFT = (1u << 3),
52 SLIDE_OUT = (1u << 5),
55 COLOR_TRANSITION = (1u << 8)
void setEffect(int e, int a, int t=0)
Set an effect for the element.
bool isVisible()
Checks whether or not the element is visible.
int effectTarget
Effect target amount.
void setMaxX(int x)
Sets the maximum x offset of the element.
void setEffectOnOver(int e, int a, int t=0)
Sets an effect to be enabled on wiimote cursor over.
float xscale
Element X scale (1 = 100%)
int ymax
Element's max Y offset allowed.
int alphaDyn
Element alpha, dynamic (multiplied by alpha value for blending/fading effects)
int getTop()
Gets the current topmost coordinate of the element Considers vertical alignment, y offset,...
int xmax
Element's max X offset allowed.
virtual int getSelected()
Gets whether or not the element is in STATE::SELECTED.
int xmin
Element's min X offset allowed.
float getScaleX()
Gets the element's current x scale Considers scale, scaleDyn, and the parent element's GetScale() val...
int isFocused()
Checks whether the element is in focus.
int effectAmount
Effect amount.
int ymin
Element's min Y offset allowed.
int alpha
Element alpha value (0-255)
void setRemoveOnDestroy(bool autoRemove)
Whether to notify parent on destruction to allow removal.
virtual void resetText()
Called when the language has changed, to obtain new text values for all text elements.
int getStateChan()
Gets the controller channel that last changed the element's state.
bool selectable
Whether or not this element selectable (can change to SELECTED state)
void setClickable(bool c)
Sets whether or not the element is clickable.
STATE getState()
Gets the element's current state.
int yoffsetDyn
Element Y offset, dynamic (added to yoffset value for animation effects)
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.
void setTrigger(GuiTrigger *t)
Set a new GuiTrigger for the element.
ALIGN_H alignmentHor
Horizontal element alignment, respective to parent element (LEFT, RIGHT, CENTRE)
virtual void setState(STATE s, int c=-1)
Sets the element's state.
void setRumble(bool r)
Sets whether or not the element is requesting a rumble event.
float scaleDyn
Element scale, dynamic (multiplied by alpha value for blending/fading effects)
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).
virtual void setFocus(int f)
Sets the element's focus.
void setMaxY(int y)
Sets the maximum y offset of the element.
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.
float getScaleY()
Gets the element's current y scale Considers scale, scaleDyn, and the parent element's GetScale() val...
virtual void setVisible(bool v)
Sets the element's visibility.
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.
virtual void update(InputController *c)
Called constantly to allow the element to respond to the current input data.
int getEffect()
Gets the current element effects.
GuiTrigger * trigger[MAX_TRIGGERS]
GuiTriggers (input actions) that this element responds to.
void setSize(int w, int h)
Sets the size (width/height) of the element.
int getWidth()
Gets the current width of the element.
bool rumble
Wiimote rumble (on/off) - set to on when this element requests a rumble event.
GuiElement * getParent()
Gets the element's parent.
void setAlpha(int a)
Sets the element's alpha value.
bool visible
Visibility of the element.
virtual void layout()
Brings the element's own layout up to date.
int getLeft()
Gets the current leftmost coordinate of the element Considers horizontal alignment,...
void setMinX(int x)
Sets the minimum x offset of the element.
void setScaleX(float s)
Sets the element's x scale.
virtual void setLayoutPosition(int x, int y)
Places the element so its top-left corner is at (x, y) relative to its parent's top-left (default: LE...
ALIGN_V alignmentVert
Horizontal element alignment, respective to parent element (TOP, BOTTOM, MIDDLE)
int getMaxY()
Gets the maximum y offset of the element.
void setParent(GuiElement *e)
Set the element's parent.
virtual void draw()=0
Called constantly to redraw the element.
int focus
Element focus (-1 = focus disabled, 0 = not focused, 1 = focused)
int getMinX()
Gets the minimum x offset of the element.
void setScale(float s)
Sets the element's x and y scale.
int getMaxX()
Gets the maximum x offset of the element.
float yscale
Element Y scale (1 = 100%)
int yoffset
Element Y offset.
void setMinY(int y)
Sets the minimum y offset of the element.
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.
int getMinY()
Gets the minimum y offset of the element.
virtual void remove(GuiElement *)
Removes the specified child.
bool isSelectable()
Checks whether or not the element is selectable.
int xoffsetDyn
Element X offset, dynamic (added to xoffset value for animation effects)
void setHoldable(bool h)
Sets whether or not the element is holdable.
bool removeOnDestroy
Whether to instruct parent to remove this element when it is destroyed.
void setUpdateCallback(UpdateCallback u)
Sets a function to called after after Update() Callback function can be used to response to changes i...
void setPosition(int x, int y)
Sets the element's position.
float getScale()
Gets the element's current scale Considers scale, scaleDyn, and the parent element's GetScale() value...
bool isHoldable()
Checks whether or not the element is holdable.
virtual void collectNavigable(std::vector< GuiElement * > &out)
Appends the elements that selection can move between (default: this element; layout containers add th...
virtual ~GuiElement()
Destructor.
void setEffectGrow()
Shortcut to SetEffectOnOver(EFFECT::SCALE, 4, 110)
virtual void setLayoutSize(int w, int h)
Gives the element a size chosen by a container (default: sets width and height)
void setSelectable(bool s)
Sets whether or not the element is selectable.
virtual void getNaturalSize(int &w, int &h)
Layout protocol: how a layout container (GuiRow, GuiColumn, GuiGrid, GuiOverlay) asks about and arran...
int getHeight()
Gets the height of the element.
void setScaleY(float s)
Sets the element's y scale.
int getAlpha()
Gets the element's alpha value Considers alpha, alphaDyn, and the parent element's GetAlpha() value.
virtual void setAlignment(ALIGN_H hor, ALIGN_V vert)
Sets the element's alignment respective to its parent element.
int xoffset
Element X offset.
Input-condition matcher attached to a GuiElement (via setSimpleTrigger() etc.) and evaluated against ...
STATE
Interaction state of a GuiElement (default, selected, clicked, held, disabled).
EFFECT
Bitmask of transition effects (slide, fade, scale, color) applied to a GuiElement.
ALIGN_V
Vertical alignment of a GuiElement relative to its parent.
ALIGN_H
Horizontal alignment of a GuiElement relative to its parent.