summaryrefslogtreecommitdiff
path: root/engine/src/windowing/mouse.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-09-01 18:24:39 +0200
committerHampusM <hampus@hampusmat.com>2026-09-01 18:24:39 +0200
commit12f7283b34b9504cafe9448ede110b1fc2a3ae41 (patch)
tree529644b6722382e14461c41f28ae42f2f5404132 /engine/src/windowing/mouse.rs
parent632a7188ea267c93b5317ceffd18f1dab0e97cbe (diff)
refactor(engine): replace MapVec with intmap crate
Diffstat (limited to 'engine/src/windowing/mouse.rs')
-rw-r--r--engine/src/windowing/mouse.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/engine/src/windowing/mouse.rs b/engine/src/windowing/mouse.rs
index f6087f4..3a43e79 100644
--- a/engine/src/windowing/mouse.rs
+++ b/engine/src/windowing/mouse.rs
@@ -106,6 +106,25 @@ pub enum Button
Other(u16),
}
+impl intmap::IntKey for Button
+{
+ type Int = u32;
+
+ const PRIME: Self::Int = <u32 as intmap::IntKey>::PRIME;
+
+ fn into_int(self) -> Self::Int
+ {
+ match &self {
+ Self::Left => 0,
+ Self::Right => 1,
+ Self::Middle => 2,
+ Self::Back => 3,
+ Self::Forward => 4,
+ Self::Other(other) => 5 + *other as u32,
+ }
+ }
+}
+
impl From<winit::event::MouseButton> for Button
{
fn from(mouse_button: winit::event::MouseButton) -> Self