Struct sdl2::VideoSubsystem

source ·
pub struct VideoSubsystem { /* private fields */ }

Implementations§

source§

impl VideoSubsystem

source§

impl VideoSubsystem

source§

impl VideoSubsystem

source

pub fn sdl(&self) -> Sdl

Obtain an SDL context.

source§

impl VideoSubsystem

source

pub fn gl_attr(&self) -> GLAttr<'_>

Obtains access to the OpenGL window attributes.

source§

impl VideoSubsystem

source

pub fn window(&self, title: &str, width: u32, height: u32) -> WindowBuilder

Initializes a new WindowBuilder; a convenience method that calls WindowBuilder::new().

source

pub fn current_video_driver(&self) -> &'static str

source

pub fn num_video_displays(&self) -> Result<i32, String>

source

pub fn display_name(&self, display_index: i32) -> Result<String, String>

Get the name of the display at the index display_name.

Will return an error if the index is out of bounds or if SDL experienced a failure; inspect the returned string for further info.

source

pub fn display_bounds(&self, display_index: i32) -> Result<Rect, String>

source

pub fn display_usable_bounds(&self, display_index: i32) -> Result<Rect, String>

source

pub fn num_display_modes(&self, display_index: i32) -> Result<i32, String>

source

pub fn display_mode( &self, display_index: i32, mode_index: i32 ) -> Result<DisplayMode, String>

source

pub fn desktop_display_mode( &self, display_index: i32 ) -> Result<DisplayMode, String>

source

pub fn current_display_mode( &self, display_index: i32 ) -> Result<DisplayMode, String>

source

pub fn closest_display_mode( &self, display_index: i32, mode: &DisplayMode ) -> Result<DisplayMode, String>

source

pub fn display_dpi(&self, display_index: i32) -> Result<(f32, f32, f32), String>

Return a triplet (ddpi, hdpi, vdpi) containing the diagonal, horizontal and vertical dots/pixels-per-inch of a display

source

pub fn display_orientation(&self, display_index: i32) -> Orientation

Return orientation of a display or Unknown if orientation could not be determined.

source

pub fn is_screen_saver_enabled(&self) -> bool

source

pub fn enable_screen_saver(&self)

source

pub fn disable_screen_saver(&self)

source

pub fn gl_load_library_default(&self) -> Result<(), String>

Loads the default OpenGL library.

This should be done after initializing the video driver, but before creating any OpenGL windows. If no OpenGL library is loaded, the default library will be loaded upon creation of the first OpenGL window.

If a different library is already loaded, this function will return an error.

source

pub fn gl_load_library<P: AsRef<Path>>(&self, path: P) -> Result<(), String>

Loads the OpenGL library using a platform-dependent OpenGL library name (usually a file path).

This should be done after initializing the video driver, but before creating any OpenGL windows. If no OpenGL library is loaded, the default library will be loaded upon creation of the first OpenGL window.

If a different library is already loaded, this function will return an error.

source

pub fn gl_unload_library(&self)

Unloads the current OpenGL library.

To completely unload the library, this should be called for every successful load of the OpenGL library.

source

pub fn gl_get_proc_address(&self, procname: &str) -> *const ()

Gets the pointer to the named OpenGL function.

This is useful for OpenGL wrappers such as gl-rs.

source

pub fn gl_extension_supported(&self, extension: &str) -> bool

source

pub fn gl_get_current_window_id(&self) -> Result<u32, String>

source

pub fn gl_release_current_context(&self) -> Result<(), String>

Releases the thread’s current OpenGL context, i.e. sets the current OpenGL context to nothing.

source

pub fn gl_set_swap_interval<S: Into<SwapInterval>>( &self, interval: S ) -> Result<(), String>

source

pub fn gl_get_swap_interval(&self) -> SwapInterval

source

pub fn vulkan_load_library_default(&self) -> Result<(), String>

Loads the default Vulkan library.

This should be done after initializing the video driver, but before creating any Vulkan windows. If no Vulkan library is loaded, the default library will be loaded upon creation of the first Vulkan window.

If a different library is already loaded, this function will return an error.

source

pub fn vulkan_load_library<P: AsRef<Path>>(&self, path: P) -> Result<(), String>

Loads the Vulkan library using a platform-dependent Vulkan library name (usually a file path).

This should be done after initializing the video driver, but before creating any Vulkan windows. If no Vulkan library is loaded, the default library will be loaded upon creation of the first Vulkan window.

If a different library is already loaded, this function will return an error.

source

pub fn vulkan_unload_library(&self)

Unloads the current Vulkan library.

To completely unload the library, this should be called for every successful load of the Vulkan library.

source

pub fn vulkan_get_proc_address_function(&self) -> Result<*const (), String>

Gets the pointer to the vkGetInstanceProcAddr Vulkan function. This function can be called to retrieve the address of other Vulkan functions.

Trait Implementations§

source§

impl Clone for VideoSubsystem

source§

fn clone(&self) -> VideoSubsystem

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VideoSubsystem

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.