Skip to content

Commit

Permalink
Replace g with gilrs for cleaner git diff
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-holmes committed Feb 23, 2025
1 parent fdf099d commit a89d19e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions crates/bevy_gilrs/src/gilrs_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ pub fn gilrs_event_startup_system(
mut gamepads: ResMut<GilrsGamepads>,
mut events: EventWriter<GamepadConnectionEvent>,
) {
gilrs.with(|g| {
for (id, gamepad) in g.gamepads() {
gilrs.with(|gilrs| {
for (id, gamepad) in gilrs.gamepads() {
// Create entity and add to mapping
let entity = commands.spawn_empty().id();
gamepads.id_to_entity.insert(id, entity);
Expand All @@ -45,12 +45,12 @@ pub fn gilrs_event_system(
mut button_events: EventWriter<RawGamepadButtonChangedEvent>,
mut axis_event: EventWriter<RawGamepadAxisChangedEvent>,
) {
gilrs.with(|g| {
while let Some(gilrs_event) = g.next_event().filter_ev(&axis_dpad_to_button, g) {
g.update(&gilrs_event);
gilrs.with(|gilrs| {
while let Some(gilrs_event) = gilrs.next_event().filter_ev(&axis_dpad_to_button, gilrs) {
gilrs.update(&gilrs_event);
match gilrs_event.event {
EventType::Connected => {
let pad = g.gamepad(gilrs_event.id);
let pad = gilrs.gamepad(gilrs_event.id);
let entity = gamepads.get_entity(gilrs_event.id).unwrap_or_else(|| {
let entity = commands.spawn_empty().id();
gamepads.id_to_entity.insert(gilrs_event.id, entity);
Expand Down Expand Up @@ -111,6 +111,6 @@ pub fn gilrs_event_system(
_ => (),
};
}
g.inc();
gilrs.inc();
});
}
4 changes: 2 additions & 2 deletions crates/bevy_gilrs/src/rumble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub(crate) fn play_gilrs_rumble(
mut requests: EventReader<GamepadRumbleRequest>,
mut running_rumbles: ResMut<RunningRumbleEffects>,
) {
gilrs.with(|g| {
gilrs.with(|gilrs| {
let current_time = time.elapsed();
// Remove outdated rumble effects.
for rumbles in running_rumbles.rumbles.values_mut() {
Expand All @@ -145,7 +145,7 @@ pub(crate) fn play_gilrs_rumble(
// Add new effects.
for rumble in requests.read().cloned() {
let gamepad = rumble.gamepad();
match handle_rumble_request(&mut running_rumbles, g, &gamepads, rumble, current_time) {
match handle_rumble_request(&mut running_rumbles, gilrs, &gamepads, rumble, current_time) {
Ok(()) => {}
Err(RumbleError::GilrsError(err)) => {
if let ff::Error::FfNotSupported(_) = err {
Expand Down

0 comments on commit a89d19e

Please sign in to comment.