Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
callmeclover authored May 16, 2024
1 parent ff10355 commit 43e93c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,15 @@ pub async fn main_logic(options: &[(&str, usize)], tts: &mut Tts, enigo: &mut En
}
"XY_Move" => {
let display = Screen::from_point(0, 0).unwrap().display_info;
pen.update_position((rng.gen_range(0..=display.width), rng.gen_range(0..=display.height)));
pen.update_position((rng.gen_range(0..=display.width).try_into().unwrap(), rng.gen_range(0..=display.height).try_into().unwrap()));
}
"X_Move" => {
let display = Screen::from_point(0, 0).unwrap().display_info;
pen.update_position((rng.gen_range(0..=display.width), -1));
pen.update_position((rng.gen_range(0..=display.width).try_into().unwrap(), -1));
}
"Y_Move" => {
let display = Screen::from_point(0, 0).unwrap().display_info;
pen.update_position((-1, rng.gen_range(0..=display.height)));
pen.update_position((-1, rng.gen_range(0..=display.height).try_into().unwrap()));
}
_=>{
pen.toggle_button(action);
Expand Down
8 changes: 4 additions & 4 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ impl GamepadInjector {
if !self.abs_buttons.get(button).unwrap() {
self.abs_buttons.insert(button.to_string(), true);
let mut buttons = self.buttons();
buttons |= model::GamepadInjector::get_value_of_button(button);
buttons |= GamepadInjector::get_value_of_button(button);
self.update_buttons(buttons);
} else {
self.abs_buttons.insert(button.to_string(), false);
let mut buttons = self.buttons();
buttons |= model::GamepadInjector::get_value_of_button(button);
buttons |= GamepadInjector::get_value_of_button(button);
self.update_buttons(buttons);
}
}
Expand Down Expand Up @@ -149,12 +149,12 @@ impl PenInjector {
if !self.abs_buttons.get(button).unwrap() {
self.abs_buttons.insert(button.to_string(), true);
let mut buttons = self.buttons();
buttons |= model::PenInjector::get_value_of_button(button);
buttons |= PenInjector::get_value_of_button(button);
self.update_buttons(buttons);
} else {
self.abs_buttons.insert(button.to_string(), false);
let mut buttons = self.buttons();
buttons |= model::PenInjector::get_value_of_button(button);
buttons |= PenInjector::get_value_of_button(button);
self.update_buttons(buttons);
}
}
Expand Down

0 comments on commit 43e93c4

Please sign in to comment.