I have a LibGDX program where I have added a touchpad when the program is being run in Android. The touchpad is working as desired.
I have set it so that if I touch an area of the screen that is not the touchpad or any UI buttons, it will move the touchpad to that location. That piece is working correctly as well.
However, to use the touchpad after moving it to a new location, I must lift my finger, then put it back down. I can't start dragging to use the touchpad once I put my finger in the new location.
Creating the touchpad is done in a completely standard way:
touchpad = new Touchpad(5, touchpadStyle);
Moving the touchpad is done here:
@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
Vector3 vec = new Vector3(screenX, screenY, 0);
uiStage.getCamera().unproject(vec);
touchpad.setPosition(vec.x-touchpad.getWidth()/2, vec.y - touchpad.getHeight()/2);
return false;
}
I was looking at possibly extending the Touchpad class, but I wasn't sure if it would be possible to do that way, and/or if there might be an easier way to do this that I just haven't yet discovered.
Thanks in advance!