LibGDX offers event listeners that we can attach to buttons. Inside listener there is a method touchUp()
we can override. I come from iOS dev and in iOS there was an option touchUpInside
and touchUpOutside
. Namely, if the user released the finger inside the area of a button touchUpInside
was called and if the user lifted finger outside the button area, touchUpOutside
was called. Does libGDX offer similar functionality or is up to developers to implement that? The default libgdx touchUp
does not differentiate these to scenarios.
edit: I used this code but this is extremely imprecise. I'm getting a lot of false touchUp's
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
super.touchUp(event, x, y, pointer, button);
if(x<button.getX()||x>(button.getX()+button.getWidth())||y<button.getY()||y>(button.getY()+button.getHeight())){
System.out.println("retuuurn");
return;
}
}