Skip to content

Commit 641ea45

Browse files
committed
Fixed a bug in the mouse cursor position
1 parent f83a909 commit 641ea45

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Updated the glow crate to version 0.16
1616
- Updated the bindgen crate to version 0.71
1717
- Raised the minimum supported macOS to version 13
18+
- Fixed a bug in the mouse cursor position
1819

1920
## 2.2.7
2021

rust/pyxel-engine/src/input.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ impl Pyxel {
141141
let mut value = value;
142142
match key {
143143
MOUSE_POS_X => {
144-
value = (value - self.system.screen_x) / self.system.screen_scale as i32;
144+
value = ((value - self.system.screen_x) as f64 / self.system.screen_scale) as i32;
145145
self.mouse_x = value;
146146
}
147147
MOUSE_POS_Y => {
148-
value = (value - self.system.screen_y) / self.system.screen_scale as i32;
148+
value = ((value - self.system.screen_y) as f64 / self.system.screen_scale) as i32;
149149
self.mouse_y = value;
150150
}
151151
MOUSE_WHEEL_Y => {

0 commit comments

Comments
 (0)