mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Merge pull request #964 from 17cupsofcoffee/instance-id-u32
Convert joystick instance IDs to u32s
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user