Struct VideoSubsystem

Source
pub struct VideoSubsystem { /* private fields */ }

Implementations§

Source§

impl VideoSubsystem

Source§

impl VideoSubsystem

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 window_and_renderer( &self, title: &str, width: u32, height: u32, ) -> Result<WindowCanvas, Error>

Create a window with a renderer.

Source

pub unsafe fn window_from_id( &self, id: u32, ) -> Result<ManuallyDrop<Window>, Error>

Get window from its ID

SAFETY this procedure creates a new Window handle that has no direct relation to any other Window with the same id. When this, or any Window with the same id, gets dropped, all other Windows with the same id will become invalid. A solution to make this safe would be to store the WindowContexts in the VideoSubsystem and correctly refcount the contexts.

Source

pub unsafe fn popup_window( &self, window: &Window, width: u32, height: u32, ) -> PopupWindowBuilder

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

Source

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

Source

pub fn num_video_drivers(&self) -> Result<i32, Error>

Source

pub fn displays(&self) -> Result<Vec<Display>, Error>

Source

pub fn get_primary_display(&self) -> Result<Display, Error>

Get primary display ID.

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<(), Error>

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<(), Error>

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) -> SDL_FunctionPointer

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, Error>

Source

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

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<(), Error>

Source

pub fn gl_get_swap_interval(&self) -> Result<SwapInterval, Error>

Source

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

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<(), Error>

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) -> SDL_FunctionPointer

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

Source

pub fn get_system_theme() -> SystemTheme

Get the current system theme.

Trait Implementations§

Source§

impl Clone for VideoSubsystem

Source§

fn clone(&self) -> Self

Returns a duplicate 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
Source§

impl Drop for VideoSubsystem

Source§

fn drop(&mut self)

Executes the destructor for this type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.