Multiple joysticks and Event queue

Hey,

I’m having troubles related to multiple joysticks and an empty event queue;) This isn’t for a game; but for a plugin for a 3d program (I’m not even a developer… just a 3d guy who knew enough scripting to get by). Each instance of my plugin placed in the scene, more or less, corresponds to a different joystick. I find all instances of my plugin by iterating through an object manager. The problem is, when the first instance of my plugin is found, it essentially empties the queue, so none of the other instances of my plugin receives any data because nothing is there; and by the time the queue is filled with data again, the search is through another iteration and, again, the first instance of my plugin gets all the data and the rest get none.

I’ve tried adding a check (like: POLLevent.jaxis.which==0) in the hopes that data from other joysticks would remain on the queue, but it doesn’t, the queue is cleared before any other instances of my plugin get found.

just using a vanilla SDL 1.2.14

thanks in advance for any insight:)

-kvb

What you probably want to do is have a single point in your code
collect all the joystick messages and then dispatch them
appropriately.

You can also disable joystick events and use the joystick API queries
entirely, but you’ll have to track your own state changes and need to
update at a pretty high frequency.

See ya!On Wed, Mar 24, 2010 at 11:50 AM, kvb wrote:

Hey,

I’m having troubles related to multiple joysticks and an empty event queue;)
This isn’t for a game; but for a plugin for a 3d program (I’m not even a
developer… just a 3d guy who knew enough scripting to get by). Each
instance of my plugin placed in the scene, more or less, corresponds to a
different joystick. I find all instances of my plugin by iterating through
an object manager. The problem is, when the first instance of my plugin is
found, it essentially empties the queue, so none of the other instances of
my plugin receives any data because nothing is there; and by the time the
queue is filled with data again, the search is through another iteration
and, again, the first instance of my plugin gets all the data and the rest
get none.

I’ve tried adding a check (like: POLLevent.jaxis.which==0) in the hopes that
data from other joysticks would remain on the queue, but it doesn’t, the
queue is cleared before any other instances of my plugin get found.

just using a vanilla SDL 1.2.14

thanks in advance for any insight:)

-kvb


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC