Struct sdl2_window::Sdl2Window
[−]
[src]
pub struct Sdl2Window { pub window: Window, pub context: GLContext, pub sdl_context: Sdl, pub video_subsystem: VideoSubsystem, // some fields omitted }
A window implemented by SDL2 back-end.
Fields
window: Window
SDL window handle.
context: GLContext
Allow dead code because this keeps track of the OpenGL context. Will be released on drop.
sdl_context: Sdl
SDL context.
video_subsystem: VideoSubsystem
Video subsystem.
Methods
impl Sdl2Window
[src]
fn new(settings: &WindowSettings) -> Result<Self, String>
[src]
Creates a new game window for SDL2. This will initialize SDL and the video subsystem.
You can retrieve both via the public fields on the Sdl2Window
struct.
fn with_subsystem(
video_subsystem: VideoSubsystem,
settings: &WindowSettings
) -> Result<Self, String>
[src]
video_subsystem: VideoSubsystem,
settings: &WindowSettings
) -> Result<Self, String>
Creates a window with the supplied SDL Video subsystem.
fn init_joysticks(&mut self) -> Result<u32, String>
[src]
Initialize the joystick subsystem. Required before joystick input events will be returned. Returns the number available or error.
Trait Implementations
impl BuildFromWindowSettings for Sdl2Window
[src]
fn build_from_window_settings(settings: &WindowSettings) -> Result<Self, String>
[src]
Builds the window from a WindowSettings
object. Read more
impl Drop for Sdl2Window
[src]
impl Window for Sdl2Window
[src]
fn should_close(&self) -> bool
[src]
Returns true if the window should close.
fn set_should_close(&mut self, value: bool)
[src]
Tells the window to close or stay open.
fn swap_buffers(&mut self)
[src]
Swaps render buffers. Read more
fn size(&self) -> Size
[src]
Gets the size of the window.
fn wait_event(&mut self) -> Input
[src]
Wait indefinitely for an input event to be available from the window.
fn wait_event_timeout(&mut self, timeout: Duration) -> Option<Input>
[src]
Wait for an input event to be available from the window or for the specified timeout to be reached. Read more
fn poll_event(&mut self) -> Option<Input>
[src]
Polls an input event from the window. Read more
fn draw_size(&self) -> Size
[src]
Gets the draw size of the window. Read more
impl AdvancedWindow for Sdl2Window
[src]
fn get_title(&self) -> String
[src]
Gets a copy of the title of the window.
fn set_title(&mut self, value: String)
[src]
Sets the title of the window.
fn get_exit_on_esc(&self) -> bool
[src]
Gets whether to exit when pressing esc. Read more
fn set_exit_on_esc(&mut self, value: bool)
[src]
Sets whether to exit when pressing esc. Read more
fn set_capture_cursor(&mut self, value: bool)
[src]
Sets whether to capture/grab the cursor. Read more
fn show(&mut self)
[src]
Shows the window. Read more
fn hide(&mut self)
[src]
Hides the window. Read more
fn get_position(&self) -> Option<Position>
[src]
Gets the position of window. Read more
fn set_position<P: Into<Position>>(&mut self, pos: P)
[src]
Sets the position of window. Read more
fn title(self, value: String) -> Self
[src]
Sets title on window. Read more
fn exit_on_esc(self, value: bool) -> Self
[src]
Sets whether to exit when pressing the Esc button. Read more
fn capture_cursor(self, value: bool) -> Self
[src]
Sets whether to capture/grab the cursor. Read more
fn position<P>(self, val: P) -> Self where
P: Into<Position>,
[src]
P: Into<Position>,
Sets the position of window. Read more
impl OpenGLWindow for Sdl2Window
[src]
fn get_proc_address(&mut self, proc_name: &str) -> ProcAddress
[src]
Returns the address of the specified OpenGL function if it exists. Read more
fn is_current(&self) -> bool
[src]
Returns true if this window's gl context is the current gl context.
fn make_current(&mut self)
[src]
Make the window's gl context the current gl context.