void InputDaemon::refreshIndexes() { for (int i = 0; i < SDL_NumJoysticks(); i++) { SDL_Joystick *joystick = SDL_JoystickOpen(i); SDL_JoystickID joystickID = SDL_JoystickInstanceID(joystick); InputDevice *tempdevice = joysticks->value(joystickID); if (tempdevice) { tempdevice->setIndex(i); } } }
void InputDaemon::refreshIndexes() { for (int i = 0; i < SDL_NumJoysticks(); i++) { SDL_Joystick *joystick = SDL_JoystickOpen(i); SDL_JoystickID joystickID = SDL_JoystickInstanceID(joystick); // Make sure to decrement reference count SDL_JoystickClose(joystick); InputDevice *tempdevice = joysticks->value(joystickID); if (tempdevice) { tempdevice->setIndex(i); } } }