Image

Display a sprite on screen.

Constructors

this
this(Sprite newSprite)

Ctor

Members

Functions

draw
void draw()
Undocumented in source. Be warned that the author may not have intended to support it.
update
void update(float deltaTime)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

sprite
Sprite sprite [@property getter]
Sprite sprite [@property setter]

The displayed sprite.

Inherited Members

From GuiElement

_children
GuiElement[] _children;
Undocumented in source.
_hint
Hint _hint;
Undocumented in source.
_isRegistered
bool _isRegistered;
Undocumented in source.
_isLocked
bool _isLocked;
_isMovable
bool _isMovable;
_isHovered
bool _isHovered;
_isClicked
bool _isClicked;
_isSelected
bool _isSelected;
_hasFocus
bool _hasFocus;
_isInteractable
bool _isInteractable;
_hasEventHook
bool _hasEventHook;
Undocumented in source.
_position
Vec2f _position;
_size
Vec2f _size;
_anchor
Vec2f _anchor;
_padding
Vec2f _padding;
_center
Vec2f _center;
_origin
Vec2f _origin;
Undocumented in source.
_callbackGuiElement
GuiElement _callbackGuiElement;
Undocumented in source.
_callbackId
string _callbackId;
Undocumented in source.
_isIterating
bool _isIterating;
_isWarping
bool _isWarping;
Undocumented in source.
_idChildIterator
uint _idChildIterator;
Undocumented in source.
_iteratorTimer
Timer _iteratorTimer;
_iteratorTimeOutTimer
Timer _iteratorTimeOutTimer;
Undocumented in source.
_screenCoords
Vec2f _screenCoords;
Undocumented in source.
_alignX
GuiAlignX _alignX;
Undocumented in source.
_alignY
GuiAlignY _alignY;
Undocumented in source.
_currentStateName
string _currentStateName;
Undocumented in source.
_currentState
GuiState _currentState;
_targetState
GuiState _targetState;
_initState
GuiState _initState;
Undocumented in source.
_states
GuiState[string] _states;
Undocumented in source.
_timer
Timer _timer;
Undocumented in source.
setScreenCoords
void setScreenCoords(Vec2f screenCoords)
Undocumented in source. Be warned that the author may not have intended to support it.
setCanvas
void setCanvas(bool hasCanvas_, bool isSmooth)
Undocumented in source. Be warned that the author may not have intended to support it.
canvas
Canvas canvas [@property getter]

If set, the canvas used to be rendered on.

hasCanvas
bool hasCanvas [@property getter]
bool hasCanvas [@property setter]

Is this GUI using a canvas ?

hint
Hint hint [@property getter]

The hint window to be shown when hovering this GUI.

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

The list of all its children.

nodes
GuiElement[] nodes [@property getter]

The list of all its own children.

firstChild
GuiElement firstChild [@property getter]

Return the first child gui.

lastChild
GuiElement lastChild [@property getter]

Return the last child gui.

childCount
size_t childCount [@property getter]

The number of children it currently has.

isLocked
bool isLocked [@property getter]
bool isLocked [@property setter]

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

isMovable
bool isMovable [@property getter]
bool isMovable [@property setter]

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

isHovered
bool isHovered [@property getter]
bool isHovered [@property setter]

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

isClicked
bool isClicked [@property getter]
bool isClicked [@property setter]

Is this gui clicked ?

isSelected
bool isSelected [@property getter]
bool isSelected [@property setter]

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

hasFocus
bool hasFocus [@property getter]
bool hasFocus [@property setter]

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

isInteractable
bool isInteractable [@property getter]
bool isInteractable [@property setter]

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

position
Vec2f position [@property getter]
Vec2f position [@property setter]

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).

anchor
Vec2f anchor [@property getter]
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.

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.

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.

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

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

alpha
float alpha [@property getter]
float alpha [@property setter]

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

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

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

Init
enum Init

Gui initialization options

setInitFlags
void setInitFlags(int options)

Default ctor.

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.

setHint
void setHint(string text)

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

setCallback
void setCallback(GuiElement callbackGuiElement, string callback)

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

triggerCallback
void triggerCallback()

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

doTransitionState
void doTransitionState(string stateName)

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

setState
void setState(string stateName)

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

getState
string getState()

Current state name or currently transitioning to.

addState
void addState(string stateName, GuiState state)

Add a new state to the list.

setEventHook
void setEventHook(bool hasHook)

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

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.

getAlignX
GuiAlignX getAlignX()
getAlignY
GuiAlignY getAlignY()

Returns the alignment relative to its parent.

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.

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.

onEvent
void onEvent(Event event)

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

onSubmit
void onSubmit()

Fired when clicked on.

onCancel
void onCancel()

Fired upon cancelling.

onNextTab
void onNextTab()

Fired on the next tab event.

onPreviousTab
void onPreviousTab()

Fired on the previous tab event.

onUp
void onUp()

Fired when going up.

onDown
void onDown()

Fired when going down.

onLeft
void onLeft()

Fired when going left.

onRight
void onRight()

Fired when going right.

onQuit
void onQuit()

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

onLock
void onLock()

Called when the lock state is changed.

onMovable
void onMovable()

Called when the movable state is changed.

onHover
void onHover()

Called when the hover state is changed.

onSelect
void onSelect()

Called when the select state is changed.

onFocus
void onFocus()

Called when the focus state is changed.

onInteractable
void onInteractable()

Called when the interactable state is changed.

onDeltaPosition
void onDeltaPosition(Vec2f delta)

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

onPosition
void onPosition()

Called when the position is changed.

onDeltaSize
void onDeltaSize(Vec2f delta)

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

onSize
void onSize()

Called when the size is changed.

onDeltaAnchor
void onDeltaAnchor(Vec2f delta)

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

onAnchor
void onAnchor()

Called when the anchor is changed.

onCenter
void onCenter()

Called when the center of the gui moved.

onPadding
void onPadding()

Called when the padding change.

onColor
void onColor()

Called when the color change.

onAlpha
void onAlpha()

Called when the opacity change.

onAngle
void onAngle()

Called when the angle change.

onCallback
void onCallback(string id)

Any callback set to this gui will call this.

prependChild
void prependChild(GuiElement child)

Add a gui as a child of this one.

appendChild
void appendChild(GuiElement child)

Add a gui as a child of this one.

removeChildren
void removeChildren()

Remove all the children.

removeChild
void removeChild(size_t index)

Remove the child at the specified index.

removeChild
void removeChild(GuiElement gui)

Remove the specified child.

removeSelf
void removeSelf()

Unregister itself from its parent or root.

Meta