I would like to use some of the more complex touch screen gestures that you can't access from
Gdx.input
I saw that to do this i must create a Gesture listener so i created the class GestureHandler and copied the code from the wiki. My gesture handler looks like this:
public class GestureHandler implements GestureListener {
@Override
public boolean touchDown(float x, float y, int pointer, int button) {
return false;
}
@Override
public boolean tap(float x, float y, int count, int button) {
return false;
}
@Override
public boolean longPress(float x, float y) {
return false;
}
@Override
public boolean fling(float velocityX, float velocityY, int button) {
return false;
}
@Override
public boolean pan(float x, float y, float deltaX, float deltaY) {
return false;
}
@Override
public boolean zoom(float initialDistance, float distance) {
return false;
}
@Override
public boolean pinch(Vector2 initialPointer1, Vector2 initialPointer2, Vector2 pointer1, Vector2 pointer2) {
return false;
}
}
My question is now that i have set up the gesture listener how can i use it. How can i get the info from these methods? Thank you for any help!
From the wiki:
I admit that is rather dense. But a bit farther down on the wiki you'll see:
To rephrase the above in hopefully less dense English: Your
GestureHandler
instance is passed to a LibgdxGestureDetector
instance. That object will accumulate "raw" inputs and convert them into higher-level "gestures". To get the raw inputs, it needs to be installed where the raw inputs will be delivered to it. The most basic way to install it viaGdx.input.setInputProcessor
, but you could also install it via anInputMultiplexer
(but that's not worth getting into here).