Package com.badlogic.gdx.input
Interface GestureDetector.GestureListener
-
- All Known Implementing Classes:
CameraInputController.CameraGestureListener,GestureDetector.GestureAdapter
- Enclosing class:
- GestureDetector
public static interface GestureDetector.GestureListenerRegister an instance of this class with aGestureDetectorto 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).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanfling(float velocityX, float velocityY, int button)Called when the user dragged a finger over the screen and lifted it.booleanlongPress(float x, float y)booleanpan(float x, float y, float deltaX, float deltaY)Called when the user drags a finger over the screen.booleanpanStop(float x, float y, int pointer, int button)Called when no longer panning.booleanpinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2)Called when a user performs a pinch zoom gesture.voidpinchStop()Called when no longer pinching.booleantap(float x, float y, int count, int button)Called when a tap occured.booleantouchDown(float x, float y, int pointer, int button)booleanzoom(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)
-
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 theGestureDetector.- 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 secondsvelocityY- 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-
-
pinchStop
void pinchStop()
Called when no longer pinching.
-
-