Skip to content

Commit

Permalink
Replace unnecessary Vec with a simple flag for pressed state check (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Shute052 authored Jan 29, 2024
1 parent 7c0117c commit 2601c01
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/input_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,20 +323,20 @@ impl<A: Actionlike> InputMap<A> {

// Generate the raw action presses
for (action, input_vec) in self.iter() {
let mut inputs = Vec::new();
let mut pressed = false;
let mut action_datum = ActionData::default();

for input in input_vec {
action_datum.axis_pair = input_streams.input_axis_pair(input);

if input_streams.input_pressed(input) {
inputs.push(input.clone());
pressed = true;

action_datum.value += input_streams.input_value(input, true);
}
}

if !inputs.is_empty() {
if pressed {
action_datum.state = ButtonState::JustPressed;
}

Expand Down

0 comments on commit 2601c01

Please sign in to comment.