From 171c03cf11b55d2a64e99f46babb2dac35b72b03 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 5 Apr 2026 18:29:57 +0200 Subject: feat(engine): add windowing::mouse::Buttons::all_current fn --- engine/src/windowing/mouse.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'engine/src/windowing/mouse.rs') 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 + { + 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(); -- cgit v1.2.3-18-g5258