Button
Extends: UiWidget
A focusable, clickable button: a label over a themed background. Set onActivate to a function(button as Button) to handle clicks, or subclass and override onClick() directly.
Properties
drawableText(BGE.DrawableText)onActivate(function | dynamic) — Called from onClick() when set - function(button as Button) as voidfocusSoundKey(string) — Optional Game.loadSound() key played via Game.playSound() when this button gainsclickSoundKey(string) — Optional Game.loadSound() key played via Game.playSound() when this button is
Constructor
new Button(game: BGE.Game): ButtonParameters
game(BGE.Game)
Instance Methods
setLabel(text: string): void
Sets this button's label text.
Parameters
text(string)
Returns
void
onFocus(): void
Returns
void
onClick(): void
Returns
void
draw(parent?: UiWidget): void
Parameters
parent(UiWidget, optional, default: "invalid")
Returns
void