The GLUT API supports only one connected joystick
via the glutJoystickFunc callback. For applications
such as games, multiple joysticks is common,
especially for arcade or console style play.
As a proposal, the current callback:
void glutJoystickFunc( void (* callback)( unsigned int,
int, int, int ), int pollInterval );
Should be extended to:
void glutJoystickFuncEx(
void (* callback)(
unsigned int joystickID,
unsigned int buttonMask,
int a,
int b,
int c,
int d),
int pollInterval );
Where joystickID is the numerical identifier of a
connected joystick. The four axes a, b, c, and d
are a replacement for x, y, z since modern console
joysticks often upto two analog sticks each with two
degrees of freedom.
All joystick events for all joysticks will pass to the
glutJoystickFuncEx handler.
Joystick events for the fist joystick will also pass to
the (legacy) glutJoystickFunc handler.
---------
Please express an interest here with helping with
this job, or testing it on your platform.
Logged In: YES
user_id=854844
Instead of fixing 2 or 3 or 4 axes, may I suggest that the
callback be passed an *array* of axes and an integer count
of how many axes there are?
Also, if we register one callback, once, for all joysticks,
on one poll interval, perhaps it would make sense to give
invoke the one callback once for *all* of the joysticks?
The above API suggestion would presumably result in N
invocations for N joysticks. Why not one invocation with
N*M axes (M axes per joystick)? This would help a lot in
dealing with the question of "When do I have all of my
joystick data in-hand so that I can process some of it?"
(You may not want to give favoritism to the one joystick
over another by processing one before you've had a chance to
see the other.)
I'd suggest:
void glutJoystickFuncEx( void (*callback) (int *axes,
unsigned sticks, unsigned axes_per_stick));
The n^{th} axis of the m^{th} stick would then be given by
axes[m*axes_per_stick + n], for
0 <= m < sticks, and
0 <= n < axes_per_stick.