Interface InputDevice
- All Superinterfaces:
Updatable
- All Known Implementing Classes:
AWTInput
,GDXInput
,HeadlessRenderer
,JFXInput
,TeaInputDevice
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 TypeMethodDescriptionvoid
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
fillClipboard
(String text) Copies the specified text to the system clipboard.Returns all currently active pointers.boolean
boolean
isKeyPressed
(KeyCode keyCode) Returns true if the key with the specified key code was pressed during the current frame.boolean
isKeyReleased
(KeyCode keyCode) Returns true if the key with the specified key code was released during the current frame.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.default boolean
isPointerReleased
(Rect bounds) 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.
-
Method Details
-
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
Convenience method that returns true if any of the pointer devices is currently pressed and located within the specified bounds. -
isPointerReleased
Convenience method that returns true if any of the pointer devices has been released within the specified bounds. -
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
Returns true if the key with the specified key code was pressed during the current frame. -
isKeyReleased
Returns true if the key with the specified key code was released during the current frame. -
requestTextInput
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
Copies the specified text to the system clipboard.
-