Struct sdl2::video::Window
[−]
[src]
pub struct Window { /* fields omitted */ }
Represents the "shell" of a Window
.
You can set get and set many of the SDL_Window
properties (i.e., border, size, PixelFormat
, etc)
However, you cannot directly access the pixels of the Window
.
It needs to be converted to a Canvas
to access the rendering functions.
Note: If a Window
goes out of scope but it cloned its context,
then the SDL_Window
will not be destroyed until there are no more references to the WindowContext
.
This may happen when a TextureCreator<Window>
outlives the Canvas<Window>
Methods
impl Window
[src]
fn raw(&self) -> *mut SDL_Window
[src]
unsafe fn from_ll(subsystem: VideoSubsystem, raw: *mut SDL_Window) -> Window
[src]
unsafe fn from_ref(context: Rc<WindowContext>) -> Window
[src]
Create a new Window
without taking ownership of the WindowContext
fn subsystem(&self) -> &VideoSubsystem
[src]
fn into_canvas(self) -> CanvasBuilder
[src]
Initializes a new CanvasBuilder
; a convenience method that calls CanvasBuilder::new()
.
fn context(&self) -> Rc<WindowContext>
[src]
fn id(&self) -> u32
[src]
fn gl_create_context(&self) -> Result<GLContext, String>
[src]
fn gl_set_context_to_current(&self) -> Result<(), String>
[src]
Set the window's OpenGL context to the current context on the thread.
fn gl_make_current(&self, context: &GLContext) -> Result<(), String>
[src]
fn gl_swap_window(&self)
[src]
fn display_index(&self) -> Result<i32, String>
[src]
fn set_display_mode<D>(&mut self, display_mode: D) -> Result<(), String> where
D: Into<Option<DisplayMode>>,
[src]
D: Into<Option<DisplayMode>>,
fn display_mode(&self) -> Result<DisplayMode, String>
[src]
fn window_pixel_format(&self) -> PixelFormatEnum
[src]
fn window_flags(&self) -> u32
[src]
fn set_title(&mut self, title: &str) -> Result<(), NulError>
[src]
fn title(&self) -> &str
[src]
fn set_icon<S: AsRef<SurfaceRef>>(&mut self, icon: S)
[src]
fn set_position(&mut self, x: WindowPos, y: WindowPos)
[src]
fn position(&self) -> (i32, i32)
[src]
fn set_size(&mut self, width: u32, height: u32) -> Result<(), IntegerOrSdlError>
[src]
fn size(&self) -> (u32, u32)
[src]
fn drawable_size(&self) -> (u32, u32)
[src]
fn set_minimum_size(
&mut self,
width: u32,
height: u32
) -> Result<(), IntegerOrSdlError>
[src]
&mut self,
width: u32,
height: u32
) -> Result<(), IntegerOrSdlError>
fn minimum_size(&self) -> (u32, u32)
[src]
fn set_maximum_size(
&mut self,
width: u32,
height: u32
) -> Result<(), IntegerOrSdlError>
[src]
&mut self,
width: u32,
height: u32
) -> Result<(), IntegerOrSdlError>
fn maximum_size(&self) -> (u32, u32)
[src]
fn set_bordered(&mut self, bordered: bool)
[src]
fn show(&mut self)
[src]
fn hide(&mut self)
[src]
fn raise(&mut self)
[src]
fn maximize(&mut self)
[src]
fn minimize(&mut self)
[src]
fn restore(&mut self)
[src]
fn fullscreen_state(&self) -> FullscreenType
[src]
fn set_fullscreen(
&mut self,
fullscreen_type: FullscreenType
) -> Result<(), String>
[src]
&mut self,
fullscreen_type: FullscreenType
) -> Result<(), String>
fn surface<'a>(
&'a self,
_e: &'a EventPump
) -> Result<WindowSurfaceRef<'a>, String>
[src]
&'a self,
_e: &'a EventPump
) -> Result<WindowSurfaceRef<'a>, String>
Returns a WindowSurfaceRef, which can be used like a regular Surface. This is an alternative way to the Renderer (Canvas) way to modify pixels directly in the Window.
For this to happen, simply create a WindowSurfaceRef
via this method, use the underlying
Surface however you like, and when the changes of the Surface must be applied to the
screen, call update_window
if you intend to keep using the WindowSurfaceRef afterwards,
or finish
if you don't intend to use it afterwards.
The Renderer way is of course much more flexible and recommended; even though you only want to support Software Rendering (which is what using Surface is), you can still create a Renderer which renders in a Software-based manner, so try to rely on a Renderer as much as possible !
fn set_grab(&mut self, grabbed: bool)
[src]
fn grab(&self) -> bool
[src]
fn set_brightness(&mut self, brightness: f64) -> Result<(), String>
[src]
fn brightness(&self) -> f64
[src]
fn set_gamma_ramp<'a, 'b, 'c, R, G, B>(
&mut self,
red: R,
green: G,
blue: B
) -> Result<(), String> where
R: Into<Option<&'a [u16; 256]>>,
G: Into<Option<&'b [u16; 256]>>,
B: Into<Option<&'c [u16; 256]>>,
[src]
&mut self,
red: R,
green: G,
blue: B
) -> Result<(), String> where
R: Into<Option<&'a [u16; 256]>>,
G: Into<Option<&'b [u16; 256]>>,
B: Into<Option<&'c [u16; 256]>>,
fn gamma_ramp(&self) -> Result<(Vec<u16>, Vec<u16>, Vec<u16>), String>
[src]
Trait Implementations
impl From<WindowContext> for Window
[src]
fn from(context: WindowContext) -> Window
[src]
Performs the conversion.