mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Add the ability to get/set the player index of a controller
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user