From 02523dc455a526decd037bc5a9e3a46475ff097f Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 3 Jul 2026 18:25:09 +0200 Subject: feat(engine): add position & scale factor fns to monitor handle struct --- engine/src/windowing/monitor.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'engine/src') 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 { self.inner.name() } + /// Returns the monitor's resolution. + #[inline] pub fn size(&self) -> PhysicalSize { 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 + { + 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 -- cgit v1.2.3-18-g5258