Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: MouseTrigger

[15:7] extends: FxObj

Wraps FXGL's MouseTrigger (com.almasb.fxgl.input.MouseTrigger), a data class pairing a MouseButton with an optional InputModifier. MouseTrigger implements the Trigger interface and is the mouse-side counterpart to KeyTrigger.

Methods

  • MouseTrigger (string ButtonName = "PRIMARY", string ModifierName = "NONE")

    Creates a new MouseTrigger from a MouseButton name plus an optional modifier.

    • @p ButtonName is the MouseButton enum name ("PRIMARY", "SECONDARY", "MIDDLE", "BACK", "FORWARD").
    • @p ModifierName is the InputModifier name. Defaults to "NONE".
  • adopt (object Ajo)

    Wraps an existing MouseTrigger AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a MouseTrigger.
    • @r A new wrapper.
  • getName ()

    Returns the FXGL short-form name (e.g. "LMB", "CTRL+RMB").

  • getButton ()

    Returns the MouseButton AussomJavaObject.

  • getModifier ()

    Returns the InputModifier AussomJavaObject.

  • isKey ()

    Returns false (MouseTrigger is never key-typed).

  • isButton ()

    Returns true (MouseTrigger is always button-typed).

  • isTriggered (object EventObj)

    Returns true when the given JavaFX InputEvent matches the button and modifier of this trigger.

    • @p EventObj is an AussomJavaObject around an InputEvent.
    • @r A bool.
  • isReleased (object EventObj)

    Returns true when the given JavaFX InputEvent matches a release of this trigger.

    • @p EventObj is an AussomJavaObject around an InputEvent.
    • @r A bool.
  • buttonFromString (string Value)

    Static helper: maps a button short-form string ("LMB", "MMB", "RMB", "BMB", "FMB") to the JavaFX MouseButton.

    • @p Value is the short-form string.
    • @r An AussomJavaObject around a MouseButton.
  • buttonToString (object ButtonObj)

    Static helper: maps a MouseButton to its FXGL short-form string ("LMB", etc.).

    • @p ButtonObj is an AussomJavaObject around a MouseButton.
    • @r A string.