libgdx API

com.badlogic.gdx.scenes.scene2d.utils
Class ActorGestureListener

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener
All Implemented Interfaces:
EventListener

public class ActorGestureListener
extends java.lang.Object
implements EventListener

Detects tap, long press, fling, pan, zoom, and pinch gestures on an actor. If there is only a need to detect tap, use ClickListener.

Author:
Nathan Sweet
See Also:
GestureDetector

Constructor Summary
ActorGestureListener()
           
ActorGestureListener(float halfTapSquareSize, float tapCountInterval, float longPressDuration, float maxFlingDelay)
           
 
Method Summary
 void fling(InputEvent event, float velocityX, float velocityY, int button)
           
 GestureDetector getGestureDetector()
           
 Actor getTouchDownTarget()
           
 boolean handle(Event e)
           
 boolean longPress(Actor actor, float x, float y)
          If true is returned, additional gestures will not be triggered.
 void pan(InputEvent event, float x, float y, float deltaX, float deltaY)
          The delta is the difference in stage coordinates since the last pan.
 void pinch(InputEvent event, Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2)
           
 void tap(InputEvent event, float x, float y, int count, int button)
           
 void touchDown(InputEvent event, float x, float y, int pointer, int button)
           
 void touchUp(InputEvent event, float x, float y, int pointer, int button)
           
 void zoom(InputEvent event, float initialDistance, float distance)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActorGestureListener

public ActorGestureListener()
See Also:
GestureDetector.GestureDetector(com.badlogic.gdx.input.GestureDetector.GestureListener)

ActorGestureListener

public ActorGestureListener(float halfTapSquareSize,
                            float tapCountInterval,
                            float longPressDuration,
                            float maxFlingDelay)
See Also:
GestureDetector.GestureDetector(float, float, float, float, com.badlogic.gdx.input.GestureDetector.GestureListener)
Method Detail

handle

public boolean handle(Event e)
Specified by:
handle in interface EventListener

touchDown

public void touchDown(InputEvent event,
                      float x,
                      float y,
                      int pointer,
                      int button)

touchUp

public void touchUp(InputEvent event,
                    float x,
                    float y,
                    int pointer,
                    int button)

tap

public void tap(InputEvent event,
                float x,
                float y,
                int count,
                int button)

longPress

public boolean longPress(Actor actor,
                         float x,
                         float y)
If true is returned, additional gestures will not be triggered. No event is provided because this event is triggered by time passing, not by an InputEvent.


fling

public void fling(InputEvent event,
                  float velocityX,
                  float velocityY,
                  int button)

pan

public void pan(InputEvent event,
                float x,
                float y,
                float deltaX,
                float deltaY)
The delta is the difference in stage coordinates since the last pan.


zoom

public void zoom(InputEvent event,
                 float initialDistance,
                 float distance)

pinch

public void pinch(InputEvent event,
                  Vector2 initialPointer1,
                  Vector2 initialPointer2,
                  Vector2 pointer1,
                  Vector2 pointer2)

getGestureDetector

public GestureDetector getGestureDetector()

getTouchDownTarget

public Actor getTouchDownTarget()

libgdx API

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