GuiElement

Base class of all GUI elements.

class GuiElement {}

Constructors

this
this()

Default ctor.

Members

Enums

Init
enum Init

Gui initialization options

Functions

addState
void addState(string stateName, GuiState state)

Add a new state to the list.

appendChild
void appendChild(GuiElement child)

Add a gui as a child of this one.

doTransitionState
void doTransitionState(string stateName)

Start a transition from the current state to the specified state.

draw
void draw()

Override this to render the gui itself. \ If the canvas is set, the coordinate are those *inside* the canvas.

drawOverlay
void drawOverlay()

Override this to render things above the gui. \ If the canvas is set, the coordinate are those *outside* the canvas.

getAlignX
GuiAlignX getAlignX()
getAlignY
GuiAlignY getAlignY()

Returns the alignment relative to its parent.

getState
string getState()

Current state name or currently transitioning to.

isInside
bool isInside(Vec2f pos)

Is it inside the gui ?

isOnInteractableGuiElement
bool isOnInteractableGuiElement(Vec2f pos)

Is it inside the gui and the gui is interactable ? \ Used to capture events.

onAlpha
void onAlpha()

Called when the opacity change.

onAnchor
void onAnchor()

Called when the anchor is changed.

onAngle
void onAngle()

Called when the angle change.

onCallback
void onCallback(string id)

Any callback set to this gui will call this.

onCancel
void onCancel()

Fired upon cancelling.

onCenter
void onCenter()

Called when the center of the gui moved.

onColor
void onColor()

Called when the color change.

onDeltaAnchor
void onDeltaAnchor(Vec2f delta)

Called when the anchor is changed. \ The delta value is the difference with the last anchor.

onDeltaPosition
void onDeltaPosition(Vec2f delta)

Called when the position is changed. \ The delta value is the difference with the last position.

onDeltaSize
void onDeltaSize(Vec2f delta)

Called when the size is changed. \ The delta value is the difference with the last size.

onDown
void onDown()

Fired when going down.

onEvent
void onEvent(Event event)

With the eventHook, receive all events. \ Useful if you want to control like for text input.

onFocus
void onFocus()

Called when the focus state is changed.

onHover
void onHover()

Called when the hover state is changed.

onInteractable
void onInteractable()

Called when the interactable state is changed.

onLeft
void onLeft()

Fired when going left.

onLock
void onLock()

Called when the lock state is changed.

onMovable
void onMovable()

Called when the movable state is changed.

onNextTab
void onNextTab()

Fired on the next tab event.

onPadding
void onPadding()

Called when the padding change.

onPosition
void onPosition()

Called when the position is changed.

onPreviousTab
void onPreviousTab()

Fired on the previous tab event.

onQuit
void onQuit()

Fired when the application is exiting. \ Every gui in the tree receive this.

onRight
void onRight()

Fired when going right.

onSelect
void onSelect()

Called when the select state is changed.

onSize
void onSize()

Called when the size is changed.

onSubmit
void onSubmit()

Fired when clicked on.

onUp
void onUp()

Fired when going up.

prependChild
void prependChild(GuiElement child)

Add a gui as a child of this one.

removeChild
void removeChild(GuiElement gui)

Remove the specified child.

removeChild
void removeChild(size_t index)

Remove the child at the specified index.

removeChildren
void removeChildren()

Remove all the children.

removeSelf
void removeSelf()

Unregister itself from its parent or root.

setAlign
void setAlign(GuiAlignX x, GuiAlignY y)
setAlignX
void setAlignX(GuiAlignX x)
setAlignY
void setAlignY(GuiAlignY y)

Sets the alignment relative to its parent. \ Position will be calculated from the specified alignement.

setCallback
void setCallback(GuiElement callbackGuiElement, string callback)

Set an id that will be sent to the specified gui when **triggerCallback()** is fired.

setCanvas
void setCanvas(bool hasCanvas_, bool isSmooth)
Undocumented in source. Be warned that the author may not have intended to support it.
setEventHook
void setEventHook(bool hasHook)

Does this gui receive events (with **onEvent()**) ?

setHint
void setHint(string text)

Update the hint (Text that appear when hovering the gui) of the gui.

setInitFlags
void setInitFlags(int options)

Default ctor.

setScreenCoords
void setScreenCoords(Vec2f screenCoords)
Undocumented in source. Be warned that the author may not have intended to support it.
setState
void setState(string stateName)

The gui is set *immediately* to the specified state without transition.

triggerCallback
void triggerCallback()

Send a previously set (with **setCallback()**) id to the previously specified gui.

update
void update(float deltaTime)

Override this to set the gui logic. The deltaTime is the time ratio for the last frame to the next. It is equivallent to Actual framerate / Nominal framerate. Ideally, it's equal to 1. ___ If the canvas is set, the coordinate are those *inside* the canvas.

Properties

alpha
float alpha [@property setter]

Alpha of the actual state (GuiState) of the gui. \ Call **onAlpha()** on change.

alpha
float alpha [@property getter]

Alpha of the actual state (GuiState) of the gui. \ Call **onAlpha()** on change.

anchor
Vec2f anchor [@property setter]

The anchor of the gui. (I don't think it's used right now). \ Call **onAnchor()** and **onDeltaAnchor()** and **onCenter()** on change.

anchor
Vec2f anchor [@property getter]

The anchor of the gui. (I don't think it's used right now). \ Call **onAnchor()** and **onDeltaAnchor()** and **onCenter()** on change.

angle
float angle [@property getter]
float angle [@property setter]

Angle of the actual state (GuiState) of the gui.

canvas
Canvas canvas [@property getter]

If set, the canvas used to be rendered on.

center
Vec2f center [@property getter]

Center of the gui. \ If the canvas is set, only drawOverlay have the coordinate of its parent, the rest are in a relative coordinate.

childCount
size_t childCount [@property getter]

The number of children it currently has.

children
GuiElement[] children [@property getter]

The list of all its children.

children
const(GuiElement[]) children [@property getter]

The list of all its children.

color
Color color [@property getter]
Color color [@property setter]

Color of the actual state (GuiState) of the gui. \ Call **onColor()** on change.

firstChild
GuiElement firstChild [@property getter]

Return the first child gui.

hasCanvas
bool hasCanvas [@property setter]

Is this GUI using a canvas ?

hasCanvas
bool hasCanvas [@property getter]

Is this GUI using a canvas ?

hasFocus
bool hasFocus [@property setter]

Does this gui has focus ? \ Call **onFocus()** on change.

hasFocus
bool hasFocus [@property getter]

Does this gui has focus ? \ Call **onFocus()** on change.

hint
Hint hint [@property getter]

The hint window to be shown when hovering this GUI.

isClicked
bool isClicked [@property setter]

Is this gui clicked ?

isClicked
bool isClicked [@property getter]

Is this gui clicked ?

isHovered
bool isHovered [@property setter]

Is this gui hovered ? \ Call **onHover()** on change. (<- Not for now)

isHovered
bool isHovered [@property getter]

Is this gui hovered ? \ Call **onHover()** on change. (<- Not for now)

isInteractable
bool isInteractable [@property setter]

Is this gui interactable ? \ Call **onInteractable()** on change.

isInteractable
bool isInteractable [@property getter]

Is this gui interactable ? \ Call **onInteractable()** on change.

isLocked
bool isLocked [@property setter]

Is this gui locked ? \ Call **onLock()** on change.

isLocked
bool isLocked [@property getter]

Is this gui locked ? \ Call **onLock()** on change.

isMovable
bool isMovable [@property setter]

Is this gui movable ? \ Call **onMovable()** on change.

isMovable
bool isMovable [@property getter]

Is this gui movable ? \ Call **onMovable()** on change.

isSelected
bool isSelected [@property setter]

Is this gui selected ? \ Call **onSelect()** on change.

isSelected
bool isSelected [@property getter]

Is this gui selected ? \ Call **onSelect()** on change.

lastChild
GuiElement lastChild [@property getter]

Return the last child gui.

nodes
GuiElement[] nodes [@property getter]

The list of all its own children.

origin
Vec2f origin [@property getter]

The top left corner of the gui. \ If the canvas is set, only drawOverlay have the coordinate of its parent, the rest are in a relative coordinate.

padding
Vec2f padding [@property getter]
Vec2f padding [@property setter]

Extra space on top of its size. \ Call **onPadding()** and update the gui size.

position
Vec2f position [@property setter]

The gui position relative to its parent and alignment. \ Call **onPosition()** and **onDeltaPosition()** and **onCenter()** on change.

position
Vec2f position [@property getter]

The gui position relative to its parent and alignment. \ Call **onPosition()** and **onDeltaPosition()** and **onCenter()** on change.

scale
Vec2f scale [@property getter]
Vec2f scale [@property setter]

The scale of the gui (changed by GuiState).

scaledSize
Vec2f scaledSize [@property getter]

The total size (size + scale) of the gui.

size
Vec2f size [@property getter]
Vec2f size [@property setter]

The unscaled size of the gui. \ Call **onSize()** and **onDeltaSize()** and **onCenter()** on change. \ Resize the canvas if it was set (It reallocate the canvas, so be careful).

Variables

_alignX
GuiAlignX _alignX;
Undocumented in source.
_alignY
GuiAlignY _alignY;
_anchor
Vec2f _anchor;
Undocumented in source.
_callbackGuiElement
GuiElement _callbackGuiElement;
Undocumented in source.
_callbackId
string _callbackId;
_center
Vec2f _center;
Undocumented in source.
_children
GuiElement[] _children;
Undocumented in source.
_currentState
GuiState _currentState;
Undocumented in source.
_currentStateName
string _currentStateName;
_hasEventHook
bool _hasEventHook;
_hasFocus
bool _hasFocus;
Undocumented in source.
_hint
Hint _hint;
Undocumented in source.
_idChildIterator
uint _idChildIterator;
_initState
GuiState _initState;
_isClicked
bool _isClicked;
_isHovered
bool _isHovered;
_isInteractable
bool _isInteractable;
Undocumented in source.
_isIterating
bool _isIterating;
Undocumented in source.
_isLocked
bool _isLocked;
_isMovable
bool _isMovable;
Undocumented in source.
_isRegistered
bool _isRegistered;
_isSelected
bool _isSelected;
_isWarping
bool _isWarping;
_iteratorTimeOutTimer
Timer _iteratorTimeOutTimer;
Undocumented in source.
_iteratorTimer
Timer _iteratorTimer;
_origin
Vec2f _origin;
_padding
Vec2f _padding;
Undocumented in source.
_position
Vec2f _position;
Undocumented in source.
_screenCoords
Vec2f _screenCoords;
_size
Vec2f _size;
Undocumented in source.
_states
GuiState[string] _states;
_targetState
GuiState _targetState;
Undocumented in source.
_timer
Timer _timer;
Undocumented in source.

Meta