Re: [AD] Android Joysticks (patch)

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


Trent,

See how SDL does it in SDLActivity.java.
It only compiles in joystick support if API >= 12 otherwise not.
You can still buy android 2.3 devices (I still use mine).
Otherwise, someone should update the android doc to require version 3.x.

Thanks for adding support.

https://stackoverflow.com/questions/13380191/conditional-compiling-in-android

        // Set up the surface
        mSurface = new SDLSurface(getApplication());

        if(Build.VERSION.SDK_INT >= 12) {
            mJoystickHandler = new SDLJoystickHandler_API12();
        }
        else {
            mJoystickHandler = new SDLJoystickHandler();
        }

On Mon, Dec 22, 2014 at 11:12 PM, Trent Gamblin <trent@xxxxxxxxxx> wrote:
> I'm sure there are cheap devices with Android 1.x on them too. Java doesn't
> have conditional compilation though. And it has one class per file so the
> only way to do it would be duplicating the AllegroSurface and KeyListener
> classes. At that point the user is better off doing that themselves if they
> need to support 2.x.
>
> -----Original Message-----
> From: SiegeLordEx [mailto:slabode@xxxxxxxxxx]
> Sent: December 22, 2014 9:09 PM
> To: alleg-developers@xxxxxxxxxx
> Subject: Re: [AD] Android Joysticks (patch)
>
> On 12/22/2014 02:36 PM, Trent Gamblin wrote:
>> 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.
>
> A person on IRC mentioned that there still exist a few (cheap) tables with
> Android 2.x on them. I'm not at all familiar with the Android code, but is
> it possible to do some conditional compilation for this stuff? I don't know
> how much support Java has for that...
>
> -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
>
>
> ------------------------------------------------------------------------------
> 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/