libgdx API

com.badlogic.gdx.input
Class GestureDetector

java.lang.Object
  extended by com.badlogic.gdx.InputAdapter
      extended by com.badlogic.gdx.input.GestureDetector
All Implemented Interfaces:
InputProcessor

public class GestureDetector
extends InputAdapter


Nested Class Summary
static class GestureDetector.GestureAdapter
           
static interface GestureDetector.GestureListener
           
 
Constructor Summary
GestureDetector(GestureDetector.GestureListener listener)
           
GestureDetector(int halfTapSquareSize, float tapCountInterval, float longPressDuration, float maxFlingDelay, GestureDetector.GestureListener listener)
           
 
Method Summary
 boolean isLongPressed()
           
 boolean isLongPressed(float duration)
           
 boolean isPanning()
           
 void reset()
           
 boolean touchDown(int x, int y, int pointer, int button)
          Called when the screen was touched or a mouse button was pressed.
 boolean touchDragged(int x, int y, int pointer)
          Called when a finger or the mouse was dragged.
 boolean touchUp(int x, int y, int pointer, int button)
          Called when a finger was lifted or a mouse button was released.
 
Methods inherited from class com.badlogic.gdx.InputAdapter
keyDown, keyTyped, keyUp, scrolled, touchMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GestureDetector

public GestureDetector(GestureDetector.GestureListener listener)

GestureDetector

public GestureDetector(int halfTapSquareSize,
                       float tapCountInterval,
                       float longPressDuration,
                       float maxFlingDelay,
                       GestureDetector.GestureListener listener)
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 Android.

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

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
Parameters:
x - The x coordinate
y - The y coordinate
pointer - the pointer for the event.
Returns:
whether the input was processed

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 Android.

Specified by:
touchUp in interface InputProcessor
Overrides:
touchUp in class InputAdapter
Parameters:
x - The x coordinate
y - The y coordinate
pointer - the pointer for the event.
button - the button
Returns:
whether the input was processed

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()

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)