Skip to content

Commit

Permalink
Fixed a bug in the mouse cursor position
Browse files Browse the repository at this point in the history
  • Loading branch information
kitao committed Dec 8, 2024
1 parent 69859d2 commit 42ae103
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Updated the glow crate to version 0.16
- Updated the bindgen crate to version 0.71
- Raised the minimum supported macOS to version 13
- Fixed a bug in the mouse cursor position

## 2.2.7

Expand Down
4 changes: 2 additions & 2 deletions rust/pyxel-engine/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ impl Pyxel {
let mut value = value;
match key {
MOUSE_POS_X => {
value = (value - self.system.screen_x) / self.system.screen_scale as i32;
value = ((value - self.system.screen_x) as f64 / self.system.screen_scale) as i32;
self.mouse_x = value;
}
MOUSE_POS_Y => {
value = (value - self.system.screen_y) / self.system.screen_scale as i32;
value = ((value - self.system.screen_y) as f64 / self.system.screen_scale) as i32;
self.mouse_y = value;
}
MOUSE_WHEEL_Y => {
Expand Down

0 comments on commit 42ae103

Please sign in to comment.