com.badlogic.gdx.input
Interface GestureDetector.GestureListener

All Known Implementing Classes:
GestureDetector.GestureAdapter
Enclosing class:
GestureDetector

public static interface GestureDetector.GestureListener

Register an instance of this class with a GestureDetector to receive gestures such as taps, long presses, flings, panning or pinch zooming. Each method returns a boolean indicating if the event should be handed to the next listener (false to hand it to the next listener, true otherwise).

Author:
mzechner

Method Summary
 boolean fling(float velocityX, float velocityY, int button)
          Called when the user dragged a finger over the screen and lifted it.
 boolean longPress(float x, float y)
           
 boolean pan(float x, float y, float deltaX, float deltaY)
          Called when the user drags a finger over the screen.
 boolean panStop(float x, float y, int pointer, int button)
          Called when no longer panning.
 boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2)
          Called when a user performs a pinch zoom gesture.
 boolean tap(float x, float y, int count, int button)
          Called when a tap occured.
 boolean touchDown(float x, float y, int pointer, int button)
           
 boolean zoom(float initialDistance, float distance)
          Called when the user performs a pinch zoom gesture.
 

Method Detail

touchDown

boolean touchDown(float x,
                  float y,
                  int pointer,
                  int button)
See Also:
InputProcessor.touchDown(int, int, int, int)

tap

boolean tap(float x,
            float y,
            int count,
            int button)
Called when a tap occured. A tap happens if a touch went down on the screen and was lifted again without moving outside of the tap square. The tap square is a rectangular area around the initial touch position as specified on construction time of the GestureDetector.

Parameters:
count - the number of taps.

longPress

boolean longPress(float x,
                  float y)

fling

boolean fling(float velocityX,
              float velocityY,
              int button)
Called when the user dragged a finger over the screen and lifted it. Reports the last known velocity of the finger in pixels per second.

Parameters:
velocityX - velocity on x in seconds
velocityY - velocity on y in seconds

pan

boolean pan(float x,
            float y,
            float deltaX,
            float deltaY)
Called when the user drags a finger over the screen.

Parameters:
deltaX - the difference in pixels to the last drag event on x.
deltaY - the difference in pixels to the last drag event on y.

panStop

boolean panStop(float x,
                float y,
                int pointer,
                int button)
Called when no longer panning.


zoom

boolean zoom(float initialDistance,
             float distance)
Called when the user performs a pinch zoom gesture. The original distance is the distance in pixels when the gesture started.

Parameters:
initialDistance - distance between fingers when the gesture started.
distance - current distance between fingers.

pinch

boolean pinch(Vector2 initialPointer1,
              Vector2 initialPointer2,
              Vector2 pointer1,
              Vector2 pointer2)
Called when a user performs a pinch zoom gesture. Reports the initial positions of the two involved fingers and their current positions.

Parameters:
initialPointer1 -
initialPointer2 -
pointer1 -
pointer2 -


Copyright © 2014. All Rights Reserved.