Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Input

[21:7] extends: FxObj

Wraps FXGL's Input, the service that binds keyboard, mouse, and virtual-controller triggers to UserActions. Aussom users construct actions through UserAction, then register them via addActionKey / addActionMouse with the desired trigger and optional InputModifier. Aussom users normally obtain the live Input from fxgl.getInput in chunk 6; this wrapper exists for direct construction in tests and for users that hold an FXGL Input through AJI.

Methods

  • Input (Ajo = null)

    Creates an Input wrapper. With no argument constructs a new FXGL Input; with an AussomJavaObject wraps the supplied existing FXGL Input (used by fxgl.getInput to hand back a ready-to-use wrapper).

    • @p Ajo is an optional AussomJavaObject around an FXGL Input.
  • adopt (object Ajo)

    Wraps an existing Input AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an FXGL Input.
    • @r A new wrapper.
  • addActionKey (object Action, string KeyName, string ModifierName = "NONE")

    Binds a UserAction to a keyboard trigger.

    • @p Action is a UserAction wrapper.
    • @p KeyName is the KeyCode constant name (e.g. "SPACE", "A").
    • @p ModifierName is an optional InputModifier name ("NONE", "CTRL", "SHIFT", "ALT"). Defaults to "NONE".
    • @r this object
  • addActionMouse (object Action, string ButtonName, string ModifierName = "NONE")

    Binds a UserAction to a mouse-button trigger.

    • @p Action is a UserAction wrapper.
    • @p ButtonName is the MouseButton constant name (e.g. "PRIMARY").
    • @p ModifierName is an optional InputModifier name. Defaults to "NONE".
    • @r this object
  • rebindKey (object Action, string KeyName, string ModifierName = "NONE")

    Rebinds an already-registered action to a new keyboard trigger.

    • @p Action is a UserAction wrapper.
    • @p KeyName is the new KeyCode constant name.
    • @p ModifierName is an optional InputModifier name.
    • @r this object
  • getActionByName (string Name)

    Returns the action with the given name.

    • @p Name is the action name.
    • @r An AussomJavaObject wrapping a UserAction.
  • getTriggerName (string ActionName)

    Returns the trigger name string currently bound to the given action (useful for displaying rebind UIs).

    • @p ActionName is the action name.
    • @r A string with the trigger name.
  • clearAll ()

    Removes every registered action.

    • @r this object
  • update (double Tpf)

    Drives input processing one tick forward. Normally called by the scene; available for manual control.

    • @p Tpf is the elapsed time in seconds.
    • @r this object
  • mockKeyPress (string KeyName, string ModifierName = "NONE")

    Synthesizes a key-press event for the given KeyCode with an optional modifier. Used in tests and synthetic-input flows to fire bound UserActions without a physical keyboard.

    • @p KeyName is the KeyCode constant name (e.g. "SPACE", "A").
    • @p ModifierName is the InputModifier name ("NONE", "CTRL", "SHIFT", "ALT"). Defaults to "NONE".
    • @r this object
  • mockKeyRelease (string KeyName, string ModifierName = "NONE")

    Synthesizes a key-release event for the given KeyCode with an optional modifier.

    • @p KeyName is the KeyCode constant name.
    • @p ModifierName is the InputModifier name. Defaults to "NONE".
    • @r this object
  • mockButtonPress (string ButtonName, string ModifierName = "NONE", double Gx = -1.0, double Gy = -1.0)

    Synthesizes a mouse-button-press event with optional modifier and optional game-space coordinates. When Gx / Gy are negative (defaults), FXGL uses the current mouse position.

    • @p ButtonName is the MouseButton name ("PRIMARY", "SECONDARY", "MIDDLE").
    • @p ModifierName is the InputModifier name. Defaults to "NONE".
    • @p Gx is an optional game-X coordinate.
    • @p Gy is an optional game-Y coordinate.
    • @r this object
  • mockButtonRelease (string ButtonName, string ModifierName = "NONE", double Gx = -1.0, double Gy = -1.0)

    Synthesizes a mouse-button-release event with optional modifier and game-space coordinates. See mockButtonPress for the position handling.

    • @p ButtonName is the MouseButton name.
    • @p ModifierName is the InputModifier name.
    • @p Gx is an optional game-X coordinate.
    • @p Gy is an optional game-Y coordinate.
    • @r this object
  • mockTriggerPress (object TriggerObj)

    Synthesizes a trigger press for an arbitrary Trigger (KeyTrigger or MouseTrigger). Useful for higher-level mock flows where the caller already has a Trigger object.

    • @p TriggerObj is an AussomJavaObject around a Trigger.
    • @r this object
  • mockTriggerRelease (object TriggerObj)

    Synthesizes a trigger release for an arbitrary Trigger.

    • @p TriggerObj is an AussomJavaObject around a Trigger.
    • @r this object
  • setProcessInput (bool Enabled)

    Sets whether input processing is active. When false, bound UserActions stop firing -- useful for pause overlays.

    • @p Enabled is a bool.
    • @r this object
  • getProcessInput ()

    Returns whether input processing is currently active.

    • @r A bool.
  • setRegisterInput (bool Enabled)

    Sets whether new input events are registered with Input. When false, key / mouse events are dropped entirely.

    • @p Enabled is a bool.
    • @r this object
  • getRegisterInput ()

    Returns whether input registration is currently active.

    • @r A bool.
  • setDoublePressTimeThreshold (double Seconds)

    Sets the double-press time threshold in seconds.

    • @p Seconds is the threshold in seconds.
    • @r this object
  • getDoublePressTimeThreshold ()

    Returns the current double-press time threshold in seconds.

    • @r A double.
  • triggerNameProperty (object Action)

    Returns the read-only property holding the trigger-name string for the given action. Bind a Label.textProperty to this so a rebind UI updates live.

    • @p Action is a UserAction wrapper.
    • @r An AussomJavaObject around a ReadOnlyStringProperty, or null if the action is not bound.
  • triggerProperty (object Action)

    Returns the read-only property holding the live Trigger for the given action.

    • @p Action is a UserAction wrapper.
    • @r An AussomJavaObject around a ReadOnlyObjectProperty.
  • getAllBindings ()

    Returns an AussomJavaObject around the read-only map of action -> InputBinding currently registered. Useful for drawing a rebind UI that lists every action.

    • @r An AussomJavaObject around a Map.
  • getMouseXWorld ()

    Returns the current mouse X position in world coordinates.

    • @r A double.
  • getMouseYWorld ()

    Returns the current mouse Y position in world coordinates.

    • @r A double.
  • getMouseXUI ()

    Returns the current mouse X position in UI (screen-overlay) coordinates.

    • @r A double.
  • getMouseYUI ()

    Returns the current mouse Y position in UI (screen-overlay) coordinates.

    • @r A double.
  • getVectorToMouse (double Fx, double Fy)

    Returns the vector from the given game position to the mouse cursor (in world coordinates) as a Point2D AussomJavaObject. Aussom code can read components via .invoke("getX") / .invoke("getY") on the result.

    • @p Fx is the source X.
    • @p Fy is the source Y.
    • @r An AussomJavaObject around a javafx.geometry.Point2D.
  • getVectorFromMouse (double Fx, double Fy)

    Returns the vector from the mouse cursor to the given game position (the negative of getVectorToMouse).

    • @p Fx is the target X.
    • @p Fy is the target Y.
    • @r An AussomJavaObject around a javafx.geometry.Point2D.
  • getMousePositionWorld ()

    Returns the current mouse position in world coordinates as a Point2D AussomJavaObject. Read components via .invoke("getX") / .invoke("getY").

    • @r An AussomJavaObject around a javafx.geometry.Point2D.
  • getMousePositionUI ()

    Returns the current mouse position in UI (screen-overlay) coordinates as a Point2D AussomJavaObject.

    • @r An AussomJavaObject around a javafx.geometry.Point2D.
  • pressVirtual (string ButtonName)

    Drives a virtual button press, as if the on-screen controller's button was pressed.

    • @p ButtonName is the VirtualButton enum name ("A", "B", "X", "Y", "LB", "RB", "UP", "DOWN", "LEFT", "RIGHT").
    • @r this object
  • releaseVirtual (string ButtonName)

    Drives a virtual button release.

    • @p ButtonName is the VirtualButton enum name.
    • @r this object
  • createVirtualJoystick ()

    Builds an on-screen virtual joystick.

    • @r An AussomJavaObject around a VirtualJoystick (a Group).
  • createVirtualDpadView ()

    Builds an on-screen virtual D-pad view.

    • @r An AussomJavaObject around a Group containing the D-pad.
  • createXboxVirtualControllerView ()

    Builds an Xbox-style on-screen controller view.

    • @r An AussomJavaObject around a Group.
  • createPSVirtualControllerView ()

    Builds a PlayStation-style on-screen controller view.

    • @r An AussomJavaObject around a Group.
  • createVirtualMenuKeyView (string KeyName, bool MenuEnabled = false)

    Builds an on-screen menu key.

    • @p KeyName is the KeyCode enum name to fire when tapped.
    • @p MenuEnabled is whether to fire the engine menu key.
    • @r An AussomJavaObject around a Node.
  • startCapture ()

    Starts recording an InputCapture for later replay.

    • @r An AussomJavaObject around the InputCapture.
  • stopCapture ()

    Stops an in-progress capture session.

    • @r this object
  • applyCapture (object CaptureObj)

    Replays a previously captured InputCapture.

    • @p CaptureObj is an AussomJavaObject around an InputCapture.
    • @r this object
  • isIllegal (string KeyName)

    Static helper: returns whether the given KeyCode is reserved by FXGL and cannot be used as a trigger.

    • @p KeyName is the KeyCode enum name.
    • @r A bool.
  • addEventFilter (object EventTypeObj, object HandlerObj)

    Adds a raw JavaFX event filter to Input's pipeline.

    • @p EventTypeObj is an AussomJavaObject around an EventType.
    • @p HandlerObj is an AussomJavaObject around an EventHandler.
    • @r this object
  • removeEventFilter (object EventTypeObj, object HandlerObj)

    Removes a raw JavaFX event filter.

    • @p EventTypeObj is an AussomJavaObject around an EventType.
    • @p HandlerObj is an AussomJavaObject around an EventHandler.
    • @r this object
  • addEventHandler (object EventTypeObj, object HandlerObj)

    Adds a raw JavaFX event handler to Input's pipeline.

    • @p EventTypeObj is an AussomJavaObject around an EventType.
    • @p HandlerObj is an AussomJavaObject around an EventHandler.
    • @r this object
  • removeEventHandler (object EventTypeObj, object HandlerObj)

    Removes a raw JavaFX event handler.

    • @p EventTypeObj is an AussomJavaObject around an EventType.
    • @p HandlerObj is an AussomJavaObject around an EventHandler.
    • @r this object
  • fireEventViaFilters (object EventObj)

    Fires an event through Input's filter chain.

    • @p EventObj is an AussomJavaObject around the Event.
    • @r this object
  • fireEventViaHandlers (object EventObj)

    Fires an event through Input's handler chain.

    • @p EventObj is an AussomJavaObject around the Event.
    • @r this object
  • addTriggerListener (object ListenerObj)

    Adds a TriggerListener to Input. Users that need a custom TriggerListener subclass can build one through aji and pass it here.

    • @p ListenerObj is an AussomJavaObject around a TriggerListener.
    • @r this object
  • removeTriggerListener (object ListenerObj)

    Removes a TriggerListener.

    • @p ListenerObj is an AussomJavaObject around a TriggerListener.
    • @r this object
  • rebindMouse (object Action, string ButtonName, string ModifierName = "NONE")

    Rebinds an already-registered action to a mouse button.

    • @p Action is a UserAction wrapper.
    • @p ButtonName is the MouseButton enum name.
    • @p ModifierName is the InputModifier name. Defaults to "NONE".
    • @r this object
  • mouseXWorldProperty ()

    Returns the world-space mouse X ReadOnlyDoubleProperty.

  • mouseYWorldProperty ()

    Returns the world-space mouse Y ReadOnlyDoubleProperty.

  • mouseXUIProperty ()

    Returns the UI-space mouse X ReadOnlyDoubleProperty.

  • mouseYUIProperty ()

    Returns the UI-space mouse Y ReadOnlyDoubleProperty.

  • onKeyEvent (object KeyEventAjo)

    Dispatches a JavaFX KeyEvent through the Input pipeline. Exposed for test harnesses and custom event-source code.

  • onMouseEvent (object DataAjo)

    Dispatches a FXGL MouseEventData through the Input pipeline.