Class GestureDetector

    • Method Detail

      • touchDown

        public boolean touchDown​(int x,
                                 int y,
                                 int pointer,
                                 int button)
        Description copied from interface: InputProcessor
        Called when the screen was touched or a mouse button was pressed. The button parameter will be Input.Buttons.LEFT on iOS.
        Specified by:
        touchDown in interface InputProcessor
        Overrides:
        touchDown in class InputAdapter
        Parameters:
        x - The x coordinate, origin is in the upper left corner
        y - The y coordinate, origin is in the upper left corner
        pointer - the pointer for the event.
        button - the button
        Returns:
        whether the input was processed
      • touchDown

        public boolean touchDown​(float x,
                                 float y,
                                 int pointer,
                                 int button)
      • touchDragged

        public boolean touchDragged​(int x,
                                    int y,
                                    int pointer)
        Description copied from interface: InputProcessor
        Called when a finger or the mouse was dragged.
        Specified by:
        touchDragged in interface InputProcessor
        Overrides:
        touchDragged in class InputAdapter
        pointer - the pointer for the event.
        Returns:
        whether the input was processed
      • touchDragged

        public boolean touchDragged​(float x,
                                    float y,
                                    int pointer)
      • touchUp

        public boolean touchUp​(int x,
                               int y,
                               int pointer,
                               int button)
        Description copied from interface: InputProcessor
        Called when a finger was lifted or a mouse button was released. The button parameter will be Input.Buttons.LEFT on iOS.
        Specified by:
        touchUp in interface InputProcessor
        Overrides:
        touchUp in class InputAdapter
        pointer - the pointer for the event.
        button - the button
        Returns:
        whether the input was processed
      • touchUp

        public boolean touchUp​(float x,
                               float y,
                               int pointer,
                               int button)
      • touchCancelled

        public boolean touchCancelled​(int screenX,
                                      int screenY,
                                      int pointer,
                                      int button)
        Description copied from interface: InputProcessor
        Called when the touch gesture is cancelled. Reason may be from OS interruption to touch becoming a large surface such as the user cheek). Relevant on Android and iOS only. The button parameter will be Input.Buttons.LEFT on iOS.
        Specified by:
        touchCancelled in interface InputProcessor
        Overrides:
        touchCancelled in class InputAdapter
        pointer - the pointer for the event.
        button - the button
        Returns:
        whether the input was processed
      • cancel

        public void cancel()
        No further gesture events will be triggered for the current touch, if any.
      • isLongPressed

        public boolean isLongPressed()
        Returns:
        whether the user touched the screen long enough to trigger a long press event.
      • isLongPressed

        public boolean isLongPressed​(float duration)
        Parameters:
        duration -
        Returns:
        whether the user touched the screen for as much or more than the given duration.
      • isPanning

        public boolean isPanning()
      • reset

        public void reset()
      • invalidateTapSquare

        public void invalidateTapSquare()
        The tap square will no longer be used for the current touch.
      • setTapSquareSize

        public void setTapSquareSize​(float halfTapSquareSize)
      • setTapRectangleSize

        public void setTapRectangleSize​(float halfTapRectangleWidth,
                                        float halfTapRectangleHeight)
      • setTapCountInterval

        public void setTapCountInterval​(float tapCountInterval)
        Parameters:
        tapCountInterval - time in seconds that must pass for two touch down/up sequences to be detected as consecutive taps.
      • setLongPressSeconds

        public void setLongPressSeconds​(float longPressSeconds)
      • setMaxFlingDelay

        public void setMaxFlingDelay​(long maxFlingDelay)