diff options
| -rw-r--r-- | engine/src/windowing/mouse.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/engine/src/windowing/mouse.rs b/engine/src/windowing/mouse.rs index 3b08443..0ea04e2 100644 --- a/engine/src/windowing/mouse.rs +++ b/engine/src/windowing/mouse.rs @@ -46,6 +46,15 @@ impl Buttons button_data.previous_state } + /// Returns a iterator that yields buttons and their current states. Only buttons with + /// states is included. + pub fn all_current(&self) -> impl Iterator<Item = (Button, ButtonState)> + { + self.map + .iter() + .map(|(button, button_data)| (button.clone(), button_data.current_state)) + } + pub fn set(&mut self, button: Button, button_state: ButtonState) { let button_data = self.map.entry(button).or_default(); |
