# LibGDX - how to detect touchUp with GestureListener?

I'm making a game and I have implemented GestureListener as my inputprocessor. It came with a bunch of methods such as fling, pan, tap etc etc including touchDown. However, there is no touchUp method!

What I want to do is have something happen when the user does a 'fling', but I want something to happen when the user then takes their finger off the screen after flinging, probably setting a flinging boolean and testing if true when taking finger off the screen.

However, I don't see how I can get a touchUp method into my inputprocessor! Is there any work around to this or an alternative solution?

Thanks!

From here, you can see how to use the touchUpmethod that is in the InputProcessor interface with the GestureListener that you already implemented.

For what are you asking, it should be something like this:

public class Inputs implements ApplicationListener, GestureListener, InputProcessor {
boolean isFling= false;

//A lot of code with the GestureListener methods
@Override
public boolean fling(float velocityX, float velocityY, int button) {
// do something...
isFling = true;
return true;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
if(isFling) {
isFling= false;
// Do something when touchup trigger and fling finished
doSomething();
}
return false;
}
// the rest of the methods
}


In the same link, you can learn how to manage a lot of inputs at the same time with the InputMultiplexer.

Hope this helps!