I believe I can only have one joystick on my Linux box (at least,
I dunno how to get a 2nd one working :^( ), so I wanted to know
if people thought this code looked ok.
Where I previously had something like this:
if (event.type == SDL_JOYBUTTONDOWN)
I now have this:
if (event.type == SDL_JOYBUTTONDOWN &&
(num_joysticks < 2 || event.jbutton.which == player))
Where “num_joysticks” is the number of joysticks (as returned by
"SDL_NumJoysticks()"), and “player” is which player is currently
playing the game (0 for player one, 1 for player 2).
The point of the OR ("||") test is so that the code will work
with either one or two joysticks. If there’s on joystick and two
players, the players will swap the stick between moves.
If there’s two joysticks, each player will have their own (but shouldn’t
be able to screw up the other player by fiddling with their own controller).
Does that look sufficient? Thanks!