Types
PGUIButton = ref TGUIButton
TGUIButton = object of TEntity cmd*: TCallback cmdObj*: PObject lockable*, locked*: bool fWasHovered, fWasPressed: bool
Procs
proc free(obj: PGUIButton)
proc init(obj: PGUIButton; cmd: TCallback; cmdObj: PObject = nil; lockable: bool = false; locked: bool = false; colliderType: TColliderType = CTBox)
proc newGUIButton(graphic: PSprite; x: float = 0.0000000000000000e+00; y: float = 0.0000000000000000e+00; cmd: TCallback = nil; cmdObj: PObject = nil; lockable: bool = false; locked: bool = false; colliderType: TColliderType = CTBox): PGUIButton
-
graphic: sprite with button frames.
x, y: button coordinates.
cmd: command callback (to call when button is pressed).
cmdObj: callback target object.
lockable: true if button is lockable.
locked: true to lock button by default (only if lockable is true)
colliderType: collider type (CTPoint, CTBox, CTCircle, CTMask)
Note: button frames in sprite must be in this order:
- 0 - default
- 1 - pressed
- 2 - hover
- 3 - hover pressed
proc updateGUIButton(obj: PGUIButton)
Methods
method update(obj: PGUIButton) {.inline.}