Add the ability to get/set the player index of a controller

This commit is contained in:
Phillip Stephens
2022-02-08 01:14:04 -08:00
parent e282ef3acd
commit f39d7a7549
+10
View File
@@ -442,6 +442,16 @@ impl GameController {
}
}
/// Return the joystick player index of this controller
#[doc(alias = "SDL_GameControllerGetPlayerIndex")]
pub fn player_index(&self) -> i32 {
unsafe { sys::SDL_GameControllerGetPlayerIndex(self.raw) }
}
pub fn set_player_index(&self, index: i32) {
unsafe { sys::SDL_GameControllerSetPlayerIndex(self.raw, index); }
}
/// Get the position of the given `axis`
#[doc(alias = "SDL_GameControllerGetAxis")]
pub fn axis(&self, axis: Axis) -> i16 {