Skip to content

Commit

Permalink
Save last mouse position at the end of frame
Browse files Browse the repository at this point in the history
  • Loading branch information
foxtran authored and not-fl3 committed Apr 26, 2024
1 parent 6be980e commit 73a31a3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 0 additions & 3 deletions src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ pub fn mouse_delta_position() -> Vec2 {
// Calculate the delta
let delta = last_position - current_position;

// Store the current mouse position for the next frame
context.last_mouse_position = Some(current_position);

delta
}

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ impl Context {
self.keys_released.clear();
self.mouse_pressed.clear();
self.mouse_released.clear();
self.last_mouse_position = Some(crate::prelude::mouse_position_local());

self.quit_requested = false;

Expand Down

0 comments on commit 73a31a3

Please sign in to comment.