Class InputManager

  • All Implemented Interfaces:

    
    public final class InputManager
    
                        

    Handles input events and passes them to the correct components/layouts.

    • Constructor Detail

      • InputManager

        InputManager(Drawable master, KeyBinder keyBinder, Settings settings)
        Parameters:
        master - the layout to create this event manager for.
        keyBinder - the key binder to use for this event manager.
    • Method Detail

      • getMouseDown

         final Boolean getMouseDown()

        weather or not the left button/primary click is DOWN (aka repeating)

      • setKeyBinder

         final Unit setKeyBinder(KeyBinder keyBinder)
        Parameters:
        keyBinder - the key binder to use for this event manager.
      • keyTyped

         final Unit keyTyped(Character key)

        This method should be called when a printable key is typed. This key should be mapped to the user's keyboard layout!

      • keyDown

         final Unit keyDown(Keys key)

        This method should be called when a non-printable, but representable key is pressed.

      • keyDown

         final Unit keyDown(Integer code)

        This method should be called when a non-representable key is pressed.

        This is used solely for keybinding, and so the key can be any value, as long as it is consistent, and unique to that key.

      • keyUp

         final Unit keyUp(Keys key)

        This method should be called when a non-printable, but representable key is released.

      • keyUp

         final Unit keyUp(Integer code)

        This method should be called when a non-representable key is released.

        This is used solely for keybinding, and so the key can be any value, as long as it is consistent, and unique to that key.

      • recalculate

         final Unit recalculate()

        force the mouse position to be updated.

        Since:

        0.18.5

      • drop

        @ApiStatus.Internal() final Unit drop(Drawable it)

        Drop the current mouse over drawable.

      • clearModifiers

         final Unit clearModifiers()

        Clear the current keyModifiers.

        Since:

        0.20.1

      • safeFocus

         final Boolean safeFocus(Drawable drawable)

        try to focus a drawable, without throwing an exception.

        Returns:

        true if the drawable was focused successfully, and false if it is not Drawable.focusable, or if it is already focused.

        Since:

        1.0.4

      • dispatch

         final Boolean dispatch(Event event, Drawable to)

        Dispatch an event to the provided drawable.

        If the candidate drawable does not accept the event (returns false), it will be given to the parent, and so on.

        Note that changing of the to parameter is experimental.

      • focus

         final Boolean focus(Drawable focusable)

        Sets the focus to the specified focusable element, throwing an exception if the provided element is not focusable.

        Parameters:
        focusable - the element to set focus on
        Returns:

        true if focus was successfully set, false if the provided focusable is already focused