Re: [AD] demo of new joystick API

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


Robert Ohannessian wrote:
- 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?

Do you mean get *rid* of? If so, yes I agree, please. It's too close to polling for my liking.

  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.

Yes, and we could make the digital input use the same field (1.0f, 0.0f, -1.0f, with no in-betweens if directional pads can be mapped to a joystick).

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.

What about making the joystick/joystate structure have dynamicly allocated arrays? I mean, why allocate 5 sticks with 3 axis each and 32 buttons if the "joystick" only has 12 buttons (including a 4-point d-pad).

- Kitty Cat




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