Interface InputDevice

All Superinterfaces:
Updatable
All Known Implementing Classes:
AWTInput, GDXInput, HeadlessRenderer, JFXInput, TeaInputDevice

public interface InputDevice extends Updatable
Used to poll the status of the platform's input devices. This includes keyboard, mouse, and touch controls, though the available input devices depend on the platform and device. MultimediaLib applications are frame-based, so input devices can be checked by polling.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Do not rely on this method as it means application logic will be influenced by the order in which different (sub)scenes run.
    void
    Copies the specified text to the system clipboard.
    Returns all currently active pointers.
    boolean
     
    boolean
    Returns true if the key with the specified key code was pressed during the current frame.
    boolean
    Returns true if the key with the specified key code was released during the current frame.
    default boolean
    Convenience method that returns true if any of the pointer devices is currently pressed and located within the specified bounds.
    default boolean
    Convenience method that returns true if any of the pointer devices has been released within the specified bounds.
    boolean
     
    requestTextInput(String label, String initialValue)
    Shows a dialog window requesting the user to enter text.

    Methods inherited from interface nl.colorize.multimedialib.scene.Updatable

    update
  • Method Details

    • getPointers

      Iterable<Pointer> getPointers()
      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.

    • isPointerPressed

      default boolean isPointerPressed(Rect bounds)
      Convenience method that returns true if any of the pointer devices is currently pressed and located within the specified bounds.
    • isPointerReleased

      default boolean isPointerReleased(Rect bounds)
      Convenience method that returns true if any of the pointer devices has been released within the specified bounds.
    • clearPointerState

      @Deprecated void clearPointerState()
      Deprecated.
      Do not rely on this method as it means application logic will be influenced by the order in which different (sub)scenes run. Instead, try to restructure logic to avoid multiple (sub)scenes fighting for the same pointers.
      Clears all pointer state for all currently active pointers.
    • isTouchAvailable

      boolean isTouchAvailable()
    • isKeyboardAvailable

      boolean isKeyboardAvailable()
    • isKeyPressed

      boolean isKeyPressed(KeyCode keyCode)
      Returns true if the key with the specified key code was pressed during the current frame.
    • isKeyReleased

      boolean isKeyReleased(KeyCode keyCode)
      Returns true if the key with the specified key code was released during the current frame.
    • requestTextInput

      String requestTextInput(String label, String initialValue)
      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.
    • fillClipboard

      void fillClipboard(String text)
      Copies the specified text to the system clipboard.