summaryrefslogtreecommitdiff
path: root/engine/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-04-19 18:34:14 +0200
committerHampusM <hampus@hampusmat.com>2026-04-19 18:34:14 +0200
commit83505ac5a4b917f80c81560f04258edbd0e92dde (patch)
tree637bce56467002cbbdfffd8423ef9817201158a0 /engine/src
parent108c4ba52ad24ac4e370f1a303a68325fbd3f53e (diff)
feat(engine): add data_types::Dimens scalar div impl
Diffstat (limited to 'engine/src')
-rw-r--r--engine/src/data_types/dimens.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/engine/src/data_types/dimens.rs b/engine/src/data_types/dimens.rs
index 12f912e..a197560 100644
--- a/engine/src/data_types/dimens.rs
+++ b/engine/src/data_types/dimens.rs
@@ -1,4 +1,5 @@
use std::num::NonZeroU32;
+use std::ops::Div;
/// 2D dimensions.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -24,6 +25,19 @@ impl<Value> From<(Value, Value)> for Dimens<Value>
}
}
+impl<Value: Div<Output = Value> + Clone> Div<Value> for Dimens<Value>
+{
+ type Output = Self;
+
+ fn div(self, rhs: Value) -> Self::Output
+ {
+ Self {
+ width: self.width / rhs.clone(),
+ height: self.height / rhs,
+ }
+ }
+}
+
impl Dimens<u32>
{
#[must_use]