Struct sdl2::video::Window
[−]
[src]
pub struct Window { // some fields omitted }
Methods
impl Window
[src]
impl Window
[src]
impl Window
[src]
impl Window
[src]
fn renderer(self) -> RendererBuilder
Initializes a new RendererBuilder
; a convenience method that calls RendererBuilder::new()
.
fn properties<'a>(&'a mut self, _sdl: &'a Sdl) -> WindowProperties<'a>
Accesses the Window properties, such as the position, size and title of a Window.
In order to access a Window's properties, it must be guaranteed that the
event loop is not running.
This is why a reference to the application's SDL context is required
(a shared Sdl
reference is only obtainable if the event loop is not running).
The event loop could otherwise mutate a Window's properties without your consent!
Example
let mut sdl_context = sdl2::init().everything().unwrap(); let mut window = sdl_context.window("My SDL window", 800, 600).build().unwrap(); loop { let mut pos = None; for event in sdl_context.event_pump().poll_iter() { use sdl2::event::Event; match event { Event::MouseMotion { x, y, .. } => { pos = Some((x, y)); }, _ => () } } if let Some((x, y)) = pos { // Set the window title window.properties(&sdl_context).set_title(&format!("{}, {}", x, y)); } }
fn properties_getters(&self) -> WindowPropertiesGetters
Accesses the read-only Window properties.
unsafe fn from_id(id: u32) -> SdlResult<Window>
Get a Window from a stored ID.
Warning: This function is unsafe! It may introduce aliased Window values if a Window of the same ID is already being used as a variable in the application.
fn get_id(&self) -> u32
fn gl_create_context(&self) -> SdlResult<GLContext>
fn gl_set_context_to_current(&self) -> SdlResult<()>
Set the window's OpenGL context to the current context on the thread.