Struct sfml::window::VideoMode [−][src]
VideoMode defines a video mode (width, height, bpp)
A video mode is defined by a width and a height (in pixels) and a depth (in bits per pixel).
Video modes are used to setup windows at creation time.
The main usage of video modes is for fullscreen mode: indeed you must use one of the valid video modes allowed by the OS (which are defined by what the monitor and the graphics card support), otherwise your window creation will just fail.
VideoMode provides an associated function for retrieving the list of all the video modes
supported by the system: VideoMode::fullscreen_modes.
A custom video mode can also be checked directly for fullscreen compatibility
with its VideoMode::is_valid function.
Additionally, VideoMode provides a static function to get the mode currently used by
the desktop: VideoMode::desktop_mode. This allows to build windows with the same size or
pixel depth as the current resolution.
Usage example
use sfml::window::{VideoMode, Window, Style}; // Display the list of all the video modes available for fullscreen let modes = VideoMode::fullscreen_modes(); for mode in modes { println!("{:?}", mode); } // Create a window with the same pixel depth as the desktop let desktop = VideoMode::desktop_mode(); let _window = Window::new(VideoMode::new(1024, 768, desktop.bits_per_pixel), "SFML window", Style::CLOSE, &Default::default());
Fields
width: u32Video mode width, in pixels.
height: u32Video mode height, in pixels.
bits_per_pixel: u32Video mode pixel depth, in bits per pixels.
Implementations
impl VideoMode[src]
#[must_use]pub const fn new(width: u32, height: u32, bits_per_pixel: u32) -> Self[src]
Constructs a new VideoMode from the given parameters.
#[must_use]pub fn is_valid(&self) -> bool[src]
Tell whether or not a video mode is valid
The validity of video modes is only relevant when using fullscreen windows; otherwise any video mode can be used with no restriction.
return true if the video mode is valid for fullscreen mode
#[must_use]pub fn desktop_mode() -> Self[src]
Static Method, get the current desktop video mode
return the urrent desktop video mode
#[must_use]pub fn fullscreen_modes() -> Vec<Self>[src]
Static Method, retrieve all the video modes supported in fullscreen mode
When creating a fullscreen window, the video mode is restricted
to be compatible with what the graphics driver and monitor
support. This function returns the complete list of all video
modes that can be used in fullscreen mode.
The returned array is sorted from best to worst, so that
the first element will always give the best mode (higher
width, height and bits_per_pixel).
Return a vector containing all the supported VideoModes
Trait Implementations
impl Clone for VideoMode[src]
impl Copy for VideoMode[src]
impl Debug for VideoMode[src]
impl Default for VideoMode[src]
impl Eq for VideoMode[src]
impl From<(u32, u32)> for VideoMode[src]
impl Ord for VideoMode[src]
fn cmp(&self, other: &VideoMode) -> Ordering[src]
#[must_use]pub fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
impl PartialEq<VideoMode> for VideoMode[src]
impl PartialOrd<VideoMode> for VideoMode[src]
fn partial_cmp(&self, other: &VideoMode) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl StructuralEq for VideoMode[src]
impl StructuralPartialEq for VideoMode[src]
Auto Trait Implementations
impl RefUnwindSafe for VideoMode
impl Send for VideoMode
impl Sync for VideoMode
impl Unpin for VideoMode
impl UnwindSafe for VideoMode
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,