summaryrefslogtreecommitdiff
path: root/engine/src/windowing/monitor.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-07-03 18:25:09 +0200
committerHampusM <hampus@hampusmat.com>2026-07-03 18:25:09 +0200
commit02523dc455a526decd037bc5a9e3a46475ff097f (patch)
treedfc5450f844aa69f1296281aabcd84370752a9bb /engine/src/windowing/monitor.rs
parent1c3a442cd81d0e896d6d267bcc3deb8d2605547a (diff)
feat(engine): add position & scale factor fns to monitor handle struct
Diffstat (limited to 'engine/src/windowing/monitor.rs')
-rw-r--r--engine/src/windowing/monitor.rs21
1 files changed, 20 insertions, 1 deletions
diff --git a/engine/src/windowing/monitor.rs b/engine/src/windowing/monitor.rs
index ef06b36..894448a 100644
--- a/engine/src/windowing/monitor.rs
+++ b/engine/src/windowing/monitor.rs
@@ -1,4 +1,4 @@
-use crate::windowing::dpi::PhysicalSize;
+use crate::windowing::dpi::{PhysicalPosition, PhysicalSize};
/// Handle to a monitor that may or may not exist any longer.
#[derive(Debug, Clone)]
@@ -9,15 +9,34 @@ pub struct Handle
impl Handle
{
+ /// Returns a human-readable name of the monitor.
+ #[inline]
pub fn name(&self) -> Option<String>
{
self.inner.name()
}
+ /// Returns the monitor's resolution.
+ #[inline]
pub fn size(&self) -> PhysicalSize<u32>
{
self.inner.size().into()
}
+
+ /// Returns the top-left corner position of the monitor relative to the larger full
+ /// screen area.
+ #[inline]
+ pub fn position(&self) -> PhysicalPosition<i32>
+ {
+ self.inner.position().into()
+ }
+
+ /// Returns the scale factor of the underlying monitor.
+ #[inline]
+ pub fn scale_factor(&self) -> f64
+ {
+ self.inner.scale_factor()
+ }
}
impl Handle