0

How can i differentiate the mouse button on Android using LibGDX?


I'm trying to add proper mouse support for my LibGDX app, but on Android every mouse click returns the a left button. I tried it with the Emulator and a real device as well, with USB mouse.

Is It even possible with LibGDX, or with the Android API? Is it supported only from some version of Android or it's device dependent?

asked Jun 23, 2014 at 9:14

2 Answers 2

1

It is not possible to have mouse buttons in Android at all. The only way to test "right click" is to test if the user is touching with two (or more) fingers. To do so you need to use touch count.

answered Jun 23, 2014 at 9:25
Sign up to request clarification or add additional context in comments.

2 Comments

I meant actual right click with a physical mouse, so testing for touch count is not too useful, I already have the actual touch controls taken care of, so I'm not looking to emulate a mouse.
LibGDX doesn't currently expose any mouse specific functionality on Android (although Android does support mouse input).
0

Mouse buttons can be identified on touch events from Android 4.0 onwards. However, some devices are hardwired to return back/home instead of the actual button press and they can't be correctly read.

libGDX has extended mouse support as of 1.4.1 and will return the mid and right buttons correctly on a compatible device.

answered Sep 8, 2014 at 2:14

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.