ReferenceVerse

Button Widget

button widget

Updated
Watch the Knot — button-widget in ~90 seconds.

One tap on the screen and the bamboo watchtower's signal drum booms across the jungle canopy, calling your squad to the loot.

The UI button widget sits on the player's screen, waiting for a click to fire its OnClick event or a hover to trigger its HighlightEvent.

We create a new button widget in OnBegin, then subscribe our handler methods to its events so every tap and hover runs our Verse code.

Reach for the button widget when you need a custom, clickable UI element that drives game logic straight from the player's screen.

tower_ui := class(creative_device):
    OnBegin<override>()<suspends>:void =
        SignalBtn := button{}
        SignalBtn.OnClick().Subscribe(OnSignal)
        SignalBtn.HighlightEvent.Subscribe(OnHover)
    OnSignal(Msg : widget_message) : void =
        Print("Watchtower signaled!")
    OnHover(Msg : widget_message) : void =
        Print("Scout is aiming!")

Build your own lesson with button-widget

Generate a personalized, compile-checked lesson grounded in this exact reference.

Build a lesson →