I'm programming a button in LIBGX. It works good on desktop, but when I launch it on android, I have to touch in a different place to trigger it (Im using a real Android device, not an AVD) Here's a pic describing it:
Below the TouchDown code:
Gdx.input.setInputProcessor(new InputAdapter () {
public boolean touchDown (int x, int y, int pointer, int button) {
// your touch down code here
Vector3 coords = new Vector3(x, y, 0);
camara.unproject(coords);
if(coords.x >= 52 && coords.x<=129 && coords.y >= 158 && coords.y<=253){
shoot(1);
}
return true; // return true to indicate the event was handled
}
});
I had the same problem without Vector3, I started using it because it was adviced, but didn't solve much. Here's the declaration of the camera:
camara = new OrthographicCamera();
camara.setToOrtho(false, 800, 480);
I have done some research, but can't find the right solution, and I find the cameras (ortographic, real world, etc) very confusing. I will keep digging, this has taken hours and had to make the question. I hope someone can point me in the right direction.