[AD] Hotplug joysticks |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
I've got joystick hotplugging working on Windows
right now.
This is one feature that maybe should be added to
4.9 now
because it changes the semantics of how things work
a bit.
This is how it works:
The user installs joystick driver and calls
al_get_num_joysticks and al_get_joystick(x).
Everything behaves as normal until:
The (new) system event source
(al_get_system_event_source) emits a ALLEGRO_EVENT_JOYSTICK_CONFIGURED
event.
At this point, the user can ignore the event and
proceed as
normal, but if they call al_get_num_joysticks, the
present "user" configuration of sticks changed to the present "system" view of
joysticks (what is actually plugged in and not on the system at that
time.)
User calls al_get_joystick(x) again for all desired joysticks. Joysticks that are registered as event sources are
automatically removed from the queue if they're unplugged, but not until the
user calls al_get_num_joysticks. This is the key function and the only change to
the current api.
It's up to the user to register new joysticks with
their queues.
So what do you think? I think this is a 4.9 feature
but it may be best for 5.1... the reason I think it's for 4.9 is 5.1 will the
slightly change API usage.
Trent
|
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |