Class AbstractInput

  • All Implemented Interfaces:
    Input

    public abstract class AbstractInput
    extends java.lang.Object
    implements Input
    • Field Detail

      • pressedKeys

        protected final boolean[] pressedKeys
      • justPressedKeys

        protected final boolean[] justPressedKeys
      • pressedKeyCount

        protected int pressedKeyCount
      • keyJustPressed

        protected boolean keyJustPressed
    • Constructor Detail

      • AbstractInput

        public AbstractInput()
    • Method Detail

      • isKeyPressed

        public boolean isKeyPressed​(int key)
        Description copied from interface: Input
        Returns whether the key is pressed.
        Specified by:
        isKeyPressed in interface Input
        Parameters:
        key - The key code as found in Input.Keys.
        Returns:
        true or false.
      • isKeyJustPressed

        public boolean isKeyJustPressed​(int key)
        Description copied from interface: Input
        Returns whether the key has just been pressed.
        Specified by:
        isKeyJustPressed in interface Input
        Parameters:
        key - The key code as found in Input.Keys.
        Returns:
        true or false.
      • isCatchBackKey

        public boolean isCatchBackKey()
        Specified by:
        isCatchBackKey in interface Input
        Returns:
        whether the back button is currently being caught
      • setCatchBackKey

        public void setCatchBackKey​(boolean catchBack)
        Specified by:
        setCatchBackKey in interface Input
        Parameters:
        catchBack - whether to catch the back button
      • isCatchMenuKey

        public boolean isCatchMenuKey()
        Specified by:
        isCatchMenuKey in interface Input
        Returns:
        whether the menu button is currently being caught
      • setCatchMenuKey

        public void setCatchMenuKey​(boolean catchMenu)
        Specified by:
        setCatchMenuKey in interface Input
        Parameters:
        catchMenu - whether to catch the menu button
      • setCatchKey

        public void setCatchKey​(int keycode,
                                boolean catchKey)
        Description copied from interface: Input
        Sets whether the given key on Android or GWT should be caught. No effect on other platforms. All keys that are not caught may be handled by other apps or background processes on Android, or may trigger default browser behaviour on GWT. For example, media or volume buttons are handled by background media players if present, or Space key triggers a scroll. All keys you need to control your game should be caught to prevent unintended behaviour.
        Specified by:
        setCatchKey in interface Input
        Parameters:
        keycode - keycode to catch
        catchKey - whether to catch the given keycode
      • isCatchKey

        public boolean isCatchKey​(int keycode)
        Specified by:
        isCatchKey in interface Input
        Parameters:
        keycode - keycode to check if caught
        Returns:
        true if the given keycode is configured to be caught