Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: UserAction

[17:7] extends: FxObj

Wraps FXGL's UserAction, the abstract event target that an Input binds to a KeyCode or MouseButton. Construct one with a name (which doubles as its identity for equals / hashCode) and register Aussom callbacks for the four lifecycle hooks: onActionBegin (the frame the trigger is pressed), onAction (every subsequent frame while held), onActionEnd (the frame the trigger is released), and onDoubleActionBegin (a second press within the double-press window).

Methods

  • UserAction (string Name)

    Creates a new UserAction with the given name. The name is used for equality and is shown in default debug overlays.

    • @p Name is a string with the action name.
  • getName ()

    Returns the action name.

    • @r A string with the name.
  • onActionBegin (callback Cb)

    Registers the onActionBegin callback (fires once on press).

    • @p Cb is a callback with no arguments.
    • @r this object
  • onAction (callback Cb)

    Registers the onAction callback (fires every frame while held).

    • @p Cb is a callback with no arguments.
    • @r this object
  • onActionEnd (callback Cb)

    Registers the onActionEnd callback (fires once on release).

    • @p Cb is a callback with no arguments.
    • @r this object
  • onDoubleActionBegin (callback Cb)

    Registers the onDoubleActionBegin callback (fires on a second press within the double-press window).

    • @p Cb is a callback with no arguments.
    • @r this object