Re: [AD] Android Joysticks (patch)

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


Thanks. I can't see any legitimate opposition for requiring Android 3.1 so
I'll try to fix this up, with hotplugging and multiple devices at some
point.

-----Original Message-----
From: SiegeLordEx [mailto:slabode@xxxxxxxxxx] 
Sent: December 22, 2014 8:04 PM
To: alleg-developers@xxxxxxxxxx
Subject: Re: [AD] Android Joysticks (patch)

On 12/22/2014 02:36 PM, Trent Gamblin wrote:
> 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.

I guess you might fix this when you add support for multiple joysticks, but
it'd be nice if the 'if (num > 1)' check in andjoy_get_joystick was
implemented in terms of `andjoy_num_joysticks`, just to reduce the number of
magic constants.

Also, in terms of syntax, there are a few hard tabs inside the added code.

-SL


----------------------------------------------------------------------------
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers





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