diff --git a/src/sdl2/controller.rs b/src/sdl2/controller.rs index d890e2c10c3..abf72f9fbe9 100644 --- a/src/sdl2/controller.rs +++ b/src/sdl2/controller.rs @@ -363,7 +363,7 @@ impl GameController { } /// Return the joystick instance id of this controller - pub fn instance_id(&self) -> i32 { + pub fn instance_id(&self) -> u32 { let result = unsafe { let joystick = sys::SDL_GameControllerGetJoystick(self.raw); sys::SDL_JoystickInstanceID(joystick) @@ -373,7 +373,7 @@ impl GameController { // Should only fail if the joystick is NULL. panic!(get_error()) } else { - result + result as u32 } } diff --git a/src/sdl2/joystick.rs b/src/sdl2/joystick.rs index 93d5433f76b..2569b239e83 100644 --- a/src/sdl2/joystick.rs +++ b/src/sdl2/joystick.rs @@ -152,14 +152,14 @@ impl Joystick { unsafe { sys::SDL_JoystickGetAttached(self.raw) != sys::SDL_bool::SDL_FALSE } } - pub fn instance_id(&self) -> i32 { + pub fn instance_id(&self) -> u32 { let result = unsafe { sys::SDL_JoystickInstanceID(self.raw) }; if result < 0 { // Should only fail if the joystick is NULL. panic!(get_error()) } else { - result + result as u32 } }