[AD] Android Joysticks (patch)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


The attached patch adds support for a gamepad on Android. It should work on
OUYA, Fire TV, Google Nexus Player, Bluetooth controllers, SHIELD and many
others. It supports two analog sticks, and 6 buttons (A, B, X, Y, L1, R1).
It does not do anything with D-pads as those are treated like
ALLEGRO_KEY_LEFT etc and there's no way to determine if they're coming from
a gamepad or a keyboard on Android.

This adds a second ALLEGRO_JOYSTICK at index 1, in addition to the
accelerometer on index 0. I'd like to support hotplugging and multiple
gamepads with this (possibly before committing) which is possible.

The drawback of this patch and hotplugging is it requires Android 3.1 for
the analog stick code in AllegroSurface.java. Personally I don't think it
matters as it's been a few years since anyone used anything but Android 4.0.
But I'm requesting feedback nonetheless.

Attachment: android_joystick.diff
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/