/* * call-seq: * Joystick.deactivate_all() * * Deactivate all joysticks on the system. This will stop all * joystick-related events from being sent to the EventQueue. * */ VALUE rbgm_joystick_deactivateall(VALUE module) { /* Return right away if it wasn't active. */ if( !SDL_WasInit(SDL_INIT_JOYSTICK) ) { return Qnil; } int num_joysticks = SDL_NumJoysticks(); int i = 0; SDL_Joystick *joy; for(; i < num_joysticks; ++i ) { joy = SDL_JoystickOpen(i); if(joy != NULL) { SDL_JoystickClose( joy ); } } return Qnil; }