Máté Magyar
Máté Magyar

Reputation: 123

LibGDX - Mouse buttons on Android

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?

Upvotes: 0

Views: 224

Answers (2)

Zomby
Zomby

Reputation: 174

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.

Upvotes: 0

Vilda
Vilda

Reputation: 1793

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.

Upvotes: 1

Related Questions