Quick joystick event question

Are these two pieces of code equivalent? If not, how do they differ?**********************************

SDL_JoystickEventState(SDL_IGNORE);


SDL_EventState(SDL_JOYAXISMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYBALLMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYHATMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYBUTTONDOWN, SDL_IGNORE);
SDL_EventState(SDL_JOYBUTTONUP, SDL_IGNORE);


Thanks


Tyler Olsen - Director and Lead Developer
Hero of Allacrost http://www.allacrost.org

Are these two pieces of code equivalent? If not, how do they differ?


SDL_JoystickEventState(SDL_IGNORE);


SDL_EventState(SDL_JOYAXISMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYBALLMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYHATMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYBUTTONDOWN, SDL_IGNORE);
SDL_EventState(SDL_JOYBUTTONUP, SDL_IGNORE);


Thanks

The only difference between them comes up when you start trying to
unignore these events. For instance, if call
SDL_JoystickEventState(SDL_IGNORE) and then call
SDL_EventState(SDL_JOYAXISMOTION, SDL_ENABLE), you will not receive any
joystick events.On Sep 22, 2004, at 10:43 PM, Tyler Olsen wrote:


Tyler Olsen - Director and Lead Developer
Hero of Allacrost http://www.allacrost.org


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Thanks, thats exactly the answer I was looking for. Now I have another
quicky about joysticks. :)*************************************

SDL_InitSubSystem(SDL_INIT_JOYSTICK);
if (SDL_NumJoysticks() == 0) { // No joysticks found
SDL_JoystickEventState(SDL_IGNORE);
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
else // At least one joystick exists
SDL_JoystickEventState(SDL_ENABLE);


Is it a good thing or a bad thing to make the SDL_QuitSubSystem() call
if no joysticks exist on the system? Thanks


Tyler Olsen - Director and Lead Developer
Hero of Allacrost http://www.allacrost.org

Donny Viszneki wrote:

On Sep 22, 2004, at 10:43 PM, Tyler Olsen wrote:

Are these two pieces of code equivalent? If not, how do they differ?


SDL_JoystickEventState(SDL_IGNORE);


SDL_EventState(SDL_JOYAXISMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYBALLMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYHATMOTION, SDL_IGNORE);
SDL_EventState(SDL_JOYBUTTONDOWN, SDL_IGNORE);
SDL_EventState(SDL_JOYBUTTONUP, SDL_IGNORE);


Thanks

The only difference between them comes up when you start trying to
unignore these events. For instance, if call
SDL_JoystickEventState(SDL_IGNORE) and then call
SDL_EventState(SDL_JOYAXISMOTION, SDL_ENABLE), you will not receive any
joystick events.


Tyler Olsen - Director and Lead Developer
Hero of Allacrost http://www.allacrost.org


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

SDL_InitSubSystem(SDL_INIT_JOYSTICK);
if (SDL_NumJoysticks() == 0) { // No joysticks found
SDL_JoystickEventState(SDL_IGNORE);
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
else // At least one joystick exists
SDL_JoystickEventState(SDL_ENABLE);

Is it a good thing or a bad thing to make the SDL_QuitSubSystem() call
if no joysticks exist on the system? Thanks

It should be fine, but should also be unnecessary. If you don’t have
any joysticks, you shouldn’t receive any joystick events. If you are,
then please report it as a bug.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment