RE: [AD] demo of new joystick API

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


> - Type: AL_JOYSTATE
> 
>    This is a structure that is used to hold a "snapshot" of a
>    joystick's axes and buttons at a particular instant.  It contains
>    the following publically readable fields:


Could we get of those, please?

>    The `stick[s].axis[a].pos' values are always in the range -32767 to
> 32767.


Could we make it -1.0f to +1.0f? If users need to scale them, they'll
almost certainly have to divide by 32767.0 anyway.


> 3. The joystate structure is getting to be rather large now (I just
> checked: 320 bytes!).  Some of the int's could become short's to make
> copying joystates more efficient.  The button[] array could also be
> changed to an array of bytes.  Making both changes, the size is down
to
> 92 bytes.  All figures based on max sticks=5, max axes=3, max
buttons=32.


Why do joystates need to be copied around?


> 4. As a simple optimisation, I'm thinking of adding a "timestamp" or
> "watermark" field to the joystate structure.  When you call
> al_get_joystick_state() the function would check that field in the
> joystate you give it to see if the joystate has already got the latest
> state of the joystick.  If so, it can avoid doing the copying.

Timestamps are useful for other reasons, if the user can get to them.





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