Slider
Extends: UiWidget
A horizontal value picker: a label, a filled bar, and a numeric readout. Adjust with increase()/decrease() (step-sized) or set an exact value with setValue().
Properties
minValue(float)maxValue(float)step(float)value(float)repeatThrottle(BGE.UI.RepeatThrottle) — Throttles repeat-while-held Left/Right to one step perbarColor(dynamic)backgroundColor(dynamic)drawableText(BGE.DrawableText)
Constructor
new Slider(game: BGE.Game): SliderParameters
game(BGE.Game)
Instance Methods
setLabel(text: string): void
Sets a label to show alongside the value (e.g. "Volume")
Parameters
text(string)
Returns
void
getValue(): float
Returns
float
setValue(newValue: float): void
Sets the slider's value, clamped to [minValue, maxValue]
Parameters
newValue(float)
Returns
void
increase(amount?: float): void
Increases the value by step (or a given amount), clamped to maxValue
Parameters
amount(float, optional, default: "invalid") — defaults to m.step
Returns
void
decrease(amount?: float): void
Decreases the value by step (or a given amount), clamped to minValue
Parameters
amount(float, optional, default: "invalid") — defaults to m.step
Returns
void
handleInput(input: BGE.GameInput): boolean
Parameters
input(BGE.GameInput)
Returns
boolean
draw(parent?: UiWidget): void
Parameters
parent(UiWidget, optional, default: "invalid")
Returns
void