use crate::core::Monitor;
use crate::math::Vec2U;
use std::fmt::{Debug, Formatter};
use winit::monitor::VideoModeHandle;
#[derive(Clone, PartialEq)]
pub struct VideoMode(pub VideoModeHandle);
impl Debug for VideoMode {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("VideoMode").finish_non_exhaustive()
}
}
impl VideoMode {
#[inline]
pub fn size(&self) -> Vec2U {
self.0
.size()
.to_logical(self.0.monitor().scale_factor())
.into()
}
#[inline]
pub fn pixel_size(&self) -> Vec2U {
self.0.size().into()
}
#[inline]
pub fn monitor(&self) -> Monitor {
Monitor(self.0.monitor())
}
#[inline]
pub fn refresh_rate(&self) -> u32 {
self.0.refresh_rate_millihertz()
}
#[inline]
pub fn bit_depth(&self) -> u16 {
self.0.bit_depth()
}
}