using wxJoystick for more than 2 sticks?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
mbeardsley
Knows some wx things
Knows some wx things
Posts: 46
Joined: Thu Sep 25, 2014 7:40 pm

using wxJoystick for more than 2 sticks?

Post by mbeardsley » Wed Aug 19, 2015 7:47 pm

My application will need to read data from up to 4 different joysticks (I know this sounds silly, but there is a reason for this).

I am running Windows 7, with wxWidgets 3.0.2.

The docs for wxJoystick seem to imply that only Joystick1 and Joystick2 are supported (at least these are the only enumerations for joystick id). Is this true?

Looking over the source code, I don't see any reason why it wouldn't work - but I don't have the joysticks in-house yet to test with.
Has anyone ever tried to read Joystick id 3 or 4?
If I am going to have to write my own joystick interface, I'd like to know that ahead of time.

Furthermore, how can I know which joystick will be joystick 1 and which will be joystick 2?
I haven't been able to find anything on-line that explains how the mapping is decided (and this will only get more complicated as I get to the 3rd and 4th sticks)

Thanks.

User avatar
doublemax
Moderator
Moderator
Posts: 14427
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: using wxJoystick for more than 2 sticks?

Post by doublemax » Wed Aug 19, 2015 10:13 pm

Has anyone ever tried to read Joystick id 3 or 4?
3 works, so i guess 4 will work too.
Furthermore, how can I know which joystick will be joystick 1 and which will be joystick 2?
Impossible to predict, that's up to the underlying OS. If they are different models, you can distinguish them through wxJoystick::GetProductName().
Use the source, Luke!

Post Reply