pub struct VideoSubsystem { /* private fields */ }
Implementations§
Source§impl VideoSubsystem
impl VideoSubsystem
pub fn clipboard(&self) -> ClipboardUtil
Source§impl VideoSubsystem
impl VideoSubsystem
pub fn text_input(&self) -> TextInputUtil
Source§impl VideoSubsystem
impl VideoSubsystem
Sourcepub fn window(&self, title: &str, width: u32, height: u32) -> WindowBuilder
pub fn window(&self, title: &str, width: u32, height: u32) -> WindowBuilder
Initializes a new WindowBuilder
; a convenience method that calls WindowBuilder::new()
.
Sourcepub fn current_video_driver(&self) -> &'static str
pub fn current_video_driver(&self) -> &'static str
Get the name of the currently initialized video driver.
Sourcepub fn num_video_displays(&self) -> Result<i32, String>
pub fn num_video_displays(&self) -> Result<i32, String>
Get the number of available video displays.
Sourcepub fn display_name(&self, display_index: i32) -> Result<String, String>
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.
Sourcepub fn display_bounds(&self, display_index: i32) -> Result<Rect, String>
pub fn display_bounds(&self, display_index: i32) -> Result<Rect, String>
Get the desktop area represented by a display.
The primary display (display_index = 0
) is always located at 0,0.
Sourcepub fn display_usable_bounds(&self, display_index: i32) -> Result<Rect, String>
pub fn display_usable_bounds(&self, display_index: i32) -> Result<Rect, String>
Get the usable desktop area represented by a display.
The primary display (display_index = 0
) is always located at 0,0.
This is the same area as display_bounds
reports,
but with portions reserved by the system removed.
For example, on Apple’s macOS, this subtracts the area occupied by the menu bar and dock.
Setting a window to be fullscreen generally bypasses these unusable areas,
so these are good guidelines for the maximum space available to a non-fullscreen window.
Sourcepub fn num_display_modes(&self, display_index: i32) -> Result<i32, String>
pub fn num_display_modes(&self, display_index: i32) -> Result<i32, String>
Get the number of available display modes.
Sourcepub fn display_mode(
&self,
display_index: i32,
mode_index: i32,
) -> Result<DisplayMode, String>
pub fn display_mode( &self, display_index: i32, mode_index: i32, ) -> Result<DisplayMode, String>
Get information about a specific display mode.
The display modes are sorted in this priority:
- width -> largest to smallest
- height -> largest to smallest
- bits per pixel -> more colors to fewer colors
- packed pixel layout -> largest to smallest
- refresh rate -> highest to lowest
Sourcepub fn desktop_display_mode(
&self,
display_index: i32,
) -> Result<DisplayMode, String>
pub fn desktop_display_mode( &self, display_index: i32, ) -> Result<DisplayMode, String>
Get information about the desktop’s display mode.
There’s a difference between this function and current_display_mode
when SDL runs fullscreen and has changed the resolution.
In that case this function will return the previous native display mode,
and not the current display mode.
Sourcepub fn current_display_mode(
&self,
display_index: i32,
) -> Result<DisplayMode, String>
pub fn current_display_mode( &self, display_index: i32, ) -> Result<DisplayMode, String>
Get information about the current display mode.
There’s a difference between this function and desktop_display_mode
when SDL runs fullscreen and has changed the resolution.
In that case this function will return the current display mode,
and not the previous native display mode.
Sourcepub fn closest_display_mode(
&self,
display_index: i32,
mode: &DisplayMode,
) -> Result<DisplayMode, String>
pub fn closest_display_mode( &self, display_index: i32, mode: &DisplayMode, ) -> Result<DisplayMode, String>
Get the closest match to the requested display mode.
The available display modes are scanned and the closest mode matching the requested mode is returned. The mode format and refresh rate default to the desktop mode if they are set to 0.
The modes are scanned with size being first priority, format being second priority, and finally checking the refresh rate. If all the available modes are too small, then error is returned.
Sourcepub fn display_dpi(&self, display_index: i32) -> Result<(f32, f32, f32), String>
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
Sourcepub fn display_orientation(&self, display_index: i32) -> Orientation
pub fn display_orientation(&self, display_index: i32) -> Orientation
Return orientation of a display or Unknown if orientation could not be determined.
Sourcepub fn is_screen_saver_enabled(&self) -> bool
pub fn is_screen_saver_enabled(&self) -> bool
Check whether the screensaver is currently enabled.
Sourcepub fn enable_screen_saver(&self)
pub fn enable_screen_saver(&self)
Allow the screen to be blanked by a screen saver.
Sourcepub fn disable_screen_saver(&self)
pub fn disable_screen_saver(&self)
Prevent the screen from being blanked by a screen saver.
Sourcepub fn gl_load_library_default(&self) -> Result<(), String>
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.
Sourcepub fn gl_load_library<P: AsRef<Path>>(&self, path: P) -> Result<(), String>
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.
Sourcepub fn gl_unload_library(&self)
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.
Sourcepub fn gl_get_proc_address(&self, procname: &str) -> *const ()
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
.
Sourcepub fn gl_extension_supported(&self, extension: &str) -> bool
pub fn gl_extension_supported(&self, extension: &str) -> bool
Check if an OpenGL extension is supported for the current context.
This function operates on the current GL context; you must have created a context, and it must be current before calling this function. Do not assume that all contexts you create will have the same set of extensions available, or that recreating an existing context will offer the same extensions again. While it’s probably not a massive overhead, this function is not an O(1) operation. Check the extensions you care about after creating the GL context and save that information somewhere instead of calling the function every time you need to know.
Sourcepub fn gl_get_current_window_id(&self) -> Result<u32, String>
pub fn gl_get_current_window_id(&self) -> Result<u32, String>
Get the currently active OpenGL window.
Sourcepub fn gl_release_current_context(&self) -> Result<(), String>
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.
Sourcepub fn gl_set_swap_interval<S: Into<SwapInterval>>(
&self,
interval: S,
) -> Result<(), String>
pub fn gl_set_swap_interval<S: Into<SwapInterval>>( &self, interval: S, ) -> Result<(), String>
Set the swap interval for the current OpenGL context.
pub fn gl_get_swap_interval(&self) -> SwapInterval
Sourcepub fn vulkan_load_library_default(&self) -> Result<(), String>
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.
Sourcepub fn vulkan_load_library<P: AsRef<Path>>(&self, path: P) -> Result<(), String>
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.
Sourcepub fn vulkan_unload_library(&self)
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.
Sourcepub fn vulkan_get_proc_address_function(&self) -> Result<*const (), String>
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
impl Clone for VideoSubsystem
Source§fn clone(&self) -> VideoSubsystem
fn clone(&self) -> VideoSubsystem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more