Class JFXInput

java.lang.Object
nl.colorize.multimedialib.renderer.jfx.JFXInput
All Implemented Interfaces:
InputDevice, Updatable

public class JFXInput extends Object implements InputDevice
Captures the current state for mouse and keyboard events, updated using JavaFX event handlers.
  • Field Details

    • mouseEventQueue

      protected Queue<javafx.scene.input.MouseEvent> mouseEventQueue
    • keyEventQueue

      protected Queue<javafx.scene.input.KeyEvent> keyEventQueue
  • Constructor Details

    • JFXInput

      protected JFXInput(Canvas canvas)
  • Method Details

    • update

      public void update(float deltaTime)
      Description copied from interface: Updatable
      Updates this object for the current frame. deltaTime indicates the elapsed time since the last frame update, in seconds.
      Specified by:
      update in interface Updatable
    • getPointers

      public Iterable<Pointer> getPointers()
      Description copied from interface: InputDevice
      Returns all currently active pointers. Depending on the current platform and device, pointers could be based on mouse input, a trackpad, or touch controls.

      Note that the type of pointer will also influence its behavior. The mouse pointer is always included in this list, since the mouse cursor is always visible. Touch pointer are only available during the touch, as the pointer disappears once the touch event has ended.

      Specified by:
      getPointers in interface InputDevice
    • clearPointerState

      public void clearPointerState()
      Description copied from interface: InputDevice
      Clears all pointer state for all currently active pointers.
      Specified by:
      clearPointerState in interface InputDevice
    • isTouchAvailable

      public boolean isTouchAvailable()
      Specified by:
      isTouchAvailable in interface InputDevice
    • isKeyboardAvailable

      public boolean isKeyboardAvailable()
      Specified by:
      isKeyboardAvailable in interface InputDevice
    • isKeyPressed

      public boolean isKeyPressed(KeyCode keyCode)
      Description copied from interface: InputDevice
      Returns true if the key with the specified key code was pressed during the current frame.
      Specified by:
      isKeyPressed in interface InputDevice
    • isKeyReleased

      public boolean isKeyReleased(KeyCode keyCode)
      Description copied from interface: InputDevice
      Returns true if the key with the specified key code was released during the current frame.
      Specified by:
      isKeyReleased in interface InputDevice
    • requestTextInput

      public String requestTextInput(String labelText, String initialValue)
      Description copied from interface: InputDevice
      Shows a dialog window requesting the user to enter text. This method exists only because text fields, unlike other input elements such as buttons, cannot be emulated by the renderer without losing common functionality such as copy/paste. Text input must therefore be delegated to the platform so that a native text field can be used.
      Specified by:
      requestTextInput in interface InputDevice
    • fillClipboard

      public void fillClipboard(String text)
      Description copied from interface: InputDevice
      Copies the specified text to the system clipboard.
      Specified by:
      fillClipboard in interface InputDevice