pub struct ScreenDimensions { /* private fields */ }Expand description
World resource that stores screen dimensions.
Implementations§
Source§impl ScreenDimensions
impl ScreenDimensions
Sourcepub fn new(w: u32, h: u32, hidpi: f64) -> Self
pub fn new(w: u32, h: u32, hidpi: f64) -> Self
Creates a new screen dimensions object with the given width and height.
Sourcepub fn diagonal(&self) -> Vector2<f32>
pub fn diagonal(&self) -> Vector2<f32>
Returns the current logical size of window as diagonal vector.
Sourcepub fn aspect_ratio(&self) -> f32
pub fn aspect_ratio(&self) -> f32
Returns the current aspect ratio of the window.
Sourcepub fn hidpi_factor(&self) -> f64
pub fn hidpi_factor(&self) -> f64
Returns the ratio between the backing framebuffer resolution and the window size in screen pixels. This is typically one for a normal display and two for a retina display.
Sourcepub fn update(&mut self, w: f64, h: f64)
pub fn update(&mut self, w: f64, h: f64)
Updates the width and height of the screen and recomputes the aspect ratio.
Only use this if you need to programmatically set the resolution of your game. This resource is updated automatically by the engine when a resize occurs so you don’t need this unless you want to resize the game window.
Sourcepub fn update_hidpi_factor(&mut self, factor: f64)
pub fn update_hidpi_factor(&mut self, factor: f64)
Updates the hidpi factor stored in this structure.
Amethyst will call this for you automatically, most engine users won’t need this.
Trait Implementations§
Source§impl Clone for ScreenDimensions
impl Clone for ScreenDimensions
Source§fn clone(&self) -> ScreenDimensions
fn clone(&self) -> ScreenDimensions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScreenDimensions
impl Debug for ScreenDimensions
Source§impl PartialEq for ScreenDimensions
impl PartialEq for ScreenDimensions
impl StructuralPartialEq for ScreenDimensions
Auto Trait Implementations§
impl Freeze for ScreenDimensions
impl RefUnwindSafe for ScreenDimensions
impl Send for ScreenDimensions
impl Sync for ScreenDimensions
impl Unpin for ScreenDimensions
impl UnwindSafe for ScreenDimensions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SetParameter for T
impl<T> SetParameter for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.