Skip to content

button

A tap-to-press button with haptic feedback. Emits press when the player puts their finger down and release when they lift it. The cleanest input for any “do X now” action.

C# factory

WidgetDefinitions.Button(
id: "btn_a",
label: "Jump",
positionX: 0.85f, positionY: 0.8f,
sizeW: 0.18f, sizeH: 0.12f,
color: "#3b82f6",
haptic: true
);

Wire format

FieldTypeRequiredNotes
idstringyes
type"button"yes
position_x, position_ynumberno0..1 anchor.
size_w, size_hnumberno0..1 fraction of the screen.
labelstringnoButton text. Supports {key} bindings against screen.data.
colorstringno7-digit hex (e.g. #3b82f6) for the fill.
hapticbooleannoVibrate on press. Default true.
disabled_keystringnoDisable when screen.data[key] is truthy.

Events

Event typePayloadFires when
press{}Pointer down on the button.
release{}Pointer up or pointer leaves the button.

Example

manager.OnInput += (player, evt) =>
{
if (evt.WidgetId == "btn_a" && evt.EventType == "press")
{
player.Avatar.Jump();
manager.SendToPlayer(player.Id, "vibrate", new { duration_ms = 60 });
}
};