Question about Input Events for external Joysticks and Keyboards when using NativeActivity

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Question about Input Events for external Joysticks and Keyboards when using NativeActivity

Kevin Pickell
When my app gets the event callback from the NativeActivity class it then parses the AInputEvent object to see what type of input it has received.

With a little testing it seems that externally plugged in devices are given IDs starting at 4 and increasing ID numbers when the device is unplugged or re-plugged in.

Also my testing has determined that the buttons on the following devices map to the following keycodes:

/* PS2 controller has codes 188-199 */
/* X360 controller has codes 96-108 */

My issues are:

1. Is there a way to get a unique device ID of some sort so I can differentiate between the different Joystick types?
Also so I can tell if the device is a joystick or a USB keyboard?

2. When one of the analog controls is pressed on the joysticks, it seems to trigger the event but the X & Y location in the event seems to always be for the left analog input and I am not sure how to read the values for the dpad, right-analog input or analog triggers.

Are these short-comings a limitation of the current NDK interface? If so, are these going to be fixed in the next release?

Just in-case it makes a difference, my only Android device I have, and what I am using for testing is a Nexus7

Cheers,
Kevin P

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/f_rEundBLukJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.