From 5add26b42e0162d62e47bae309c8a6faa94b6d97 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 8 Feb 2022 01:40:50 -0800 Subject: [PATCH] Add ability to set/get player index on SDL controllers --- Graphics/Cargo.lock | 4 ++-- Graphics/Cargo.toml | 2 +- Graphics/src/lib.rs | 18 ++++++++++++++++++ imgui/ImGuiEngine.hpp | 1 + 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Graphics/Cargo.lock b/Graphics/Cargo.lock index efa7170c6..901266dcd 100644 --- a/Graphics/Cargo.lock +++ b/Graphics/Cargo.lock @@ -1443,7 +1443,7 @@ checksum = "96311ef4a16462c757bb6a39152c40f58f31cd2602a40fceb937e2bc34e6cbab" [[package]] name = "sdl2" version = "0.35.2" -source = "git+https://github.com/encounter/rust-sdl2.git?rev=e282ef3acd7fcb4b2ba16863a7a0a7a8439f9335#e282ef3acd7fcb4b2ba16863a7a0a7a8439f9335" +source = "git+https://github.com/encounter/rust-sdl2.git?rev=f39d7a7549fd59bebb1fb42ec12973200bb3080b#f39d7a7549fd59bebb1fb42ec12973200bb3080b" dependencies = [ "bitflags", "lazy_static", @@ -1454,7 +1454,7 @@ dependencies = [ [[package]] name = "sdl2-sys" version = "0.35.2" -source = "git+https://github.com/encounter/rust-sdl2.git?rev=e282ef3acd7fcb4b2ba16863a7a0a7a8439f9335#e282ef3acd7fcb4b2ba16863a7a0a7a8439f9335" +source = "git+https://github.com/encounter/rust-sdl2.git?rev=f39d7a7549fd59bebb1fb42ec12973200bb3080b#f39d7a7549fd59bebb1fb42ec12973200bb3080b" dependencies = [ "cfg-if 1.0.0", "libc", diff --git a/Graphics/Cargo.toml b/Graphics/Cargo.toml index ebc08d0af..e99bed742 100644 --- a/Graphics/Cargo.toml +++ b/Graphics/Cargo.toml @@ -30,7 +30,7 @@ scopeguard = "1.1.0" twox-hash = "1.6.2" winit = "0.26.1" # custom sdl2 -sdl2 = { git = "https://github.com/encounter/rust-sdl2.git", rev = "e282ef3acd7fcb4b2ba16863a7a0a7a8439f9335", features = ["no-link", "hidapi"] } +sdl2 = { git = "https://github.com/encounter/rust-sdl2.git", rev = "f39d7a7549fd59bebb1fb42ec12973200bb3080b", features = ["no-link", "hidapi"] } [dependencies.imgui] git = "https://github.com/imgui-rs/imgui-rs" diff --git a/Graphics/src/lib.rs b/Graphics/src/lib.rs index 7e32385c0..8ce13cbda 100644 --- a/Graphics/src/lib.rs +++ b/Graphics/src/lib.rs @@ -183,6 +183,8 @@ mod ffi { fn get_backend() -> Backend; fn get_backend_string() -> &'static str; fn set_fullscreen(v: bool); + fn get_controller_player_index(which: u32) -> i32; + fn set_controller_player_index(which: u32, index: i32); } } impl From