aboutsummaryrefslogtreecommitdiff
path: root/src/gamepad.rs
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-03-12 18:55:37 +0900
committerAstatin <[email protected]>2025-03-12 18:55:37 +0900
commitcd7f4140537c85a6a0ffed98a62b9593f324edbf (patch)
tree7502d953ab54c553c03d3a8cef91d36dad46b56c /src/gamepad.rs
parent3ac23c20f0d29cfad1963aa117941fb9c2827126 (diff)
Remove useless ref to state in update_events
Diffstat (limited to 'src/gamepad.rs')
-rw-r--r--src/gamepad.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/gamepad.rs b/src/gamepad.rs
index 993c100..c47464b 100644
--- a/src/gamepad.rs
+++ b/src/gamepad.rs
@@ -1,7 +1,5 @@
-use crate::state;
use crate::window::Keys;
use gilrs::{Button, GamepadId, Gilrs};
-use state::GBState;
use std::fs::File;
use std::io::{ErrorKind, Read, Write};
use winit::keyboard::KeyCode;
@@ -12,7 +10,7 @@ pub struct Gamepad {
}
pub trait Input {
- fn update_events(&mut self, cycles: u128, state: &GBState);
+ fn update_events(&mut self, cycles: u128);
fn get_action_gamepad_reg(&self) -> u8;
fn get_direction_gamepad_reg(&self) -> u8;
}
@@ -42,7 +40,7 @@ impl Gamepad {
}
impl Input for Gamepad {
- fn update_events(&mut self, _cycles: u128, _state: &GBState) {
+ fn update_events(&mut self, _cycles: u128) {
while let Some(_) = self.gilrs.next_event() {}
}
@@ -116,7 +114,7 @@ impl Keyboard {
}
impl Input for Keyboard {
- fn update_events(&mut self, _cycles: u128, _state: &GBState) {
+ fn update_events(&mut self, _cycles: u128) {
let mut res = 0xf;
let keys = self.keys.borrow();
@@ -187,8 +185,8 @@ impl GamepadRecorder {
}
impl Input for GamepadRecorder {
- fn update_events(&mut self, cycles: u128, state: &GBState) {
- self.input.update_events(cycles, state);
+ fn update_events(&mut self, cycles: u128) {
+ self.input.update_events(cycles);
let new_action_reg = self.input.get_action_gamepad_reg();
let new_direction_reg = self.input.get_direction_gamepad_reg();
@@ -254,7 +252,7 @@ impl GamepadReplay {
}
impl Input for GamepadReplay {
- fn update_events(&mut self, cycles: u128, _state: &GBState) {
+ fn update_events(&mut self, cycles: u128) {
if let Some(next_cycle_update) = self.next_cycle_update {
if cycles > next_cycle_update {
let mut inputs: [u8; 2] = [0; 2];