Skip to content

Commit

Permalink
Docs + fixed dep
Browse files Browse the repository at this point in the history
  • Loading branch information
RockasMockas committed Oct 6, 2024
1 parent 2d94bac commit 69c695d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions framework_crates/bones_bevy_renderer/src/input.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// framework_crates/bones_bevy_renderer/src/input.rs

use super::*;
use bevy::{
input::{
Expand Down
2 changes: 1 addition & 1 deletion framework_crates/bones_framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ instant = { version = "0.1", features = ["wasm-bindgen"] }
noise = "0.9"
once_cell = "1.17"
thiserror = "1.0"
gilrs = "0.11.0"

# Tracing
tracing = "0.1"
Expand Down Expand Up @@ -154,7 +155,6 @@ iroh-quinn = "0.10"
iroh-net = "0.22"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
turborand = { version = "0.10.0", features = ["atomic"] }
gilrs = "0.11.0"

directories = "5.0"

Expand Down
4 changes: 3 additions & 1 deletion framework_crates/bones_framework/src/input/gilrs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// framework_crates/bones_framework/src/input/gilrs.rs
use crate::prelude::*;
use gilrs::{ev::filter::axis_dpad_to_button, EventType, Filter, Gilrs as GilrsContext};
use once_cell::sync::Lazy;
Expand All @@ -11,6 +10,7 @@ static GILRS_CONTEXT: Lazy<Arc<Mutex<GilrsContext>>> = Lazy::new(|| {
))
});

/// Processes gilrs gamepad events into Bones-native GamepadInputs
pub fn process_gamepad_events() -> GamepadInputs {
let mut gamepad_inputs = GamepadInputs::default();
let mut gilrs = GILRS_CONTEXT.lock().unwrap();
Expand Down Expand Up @@ -67,6 +67,7 @@ pub fn process_gamepad_events() -> GamepadInputs {
gamepad_inputs
}

/// Converts a gilrs button to a bones-native button
fn convert_button(button: gilrs::Button) -> Option<GamepadButton> {
match button {
gilrs::Button::South => Some(GamepadButton::South),
Expand All @@ -92,6 +93,7 @@ fn convert_button(button: gilrs::Button) -> Option<GamepadButton> {
}
}

/// Converts a gilrs axis to a bones-native axis
fn convert_axis(axis: gilrs::Axis) -> Option<GamepadAxis> {
match axis {
gilrs::Axis::LeftStickX => Some(GamepadAxis::LeftStickX),
Expand Down

0 comments on commit 69c695d

Please sign in to comment.