diff options
| -rw-r--r-- | engine/src/windowing/monitor.rs | 21 |
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 |
