Struct sdl2::Sdl [] [src]

pub struct Sdl {
    // some fields omitted
}

The SDL context type. Initialize with sdl2::init().

From a thread-safety perspective, Sdl represents the main thread. Only one instance of Sdl is allowed per process, and cannot be moved or used across non-main threads.

As such, Sdl is a useful type for ensuring that SDL types that can only be used on the main thread are initialized that way.

For instance, SDL_PumpEvents() is not thread safe, and may only be called on the main thread. All functionality that calls SDL_PumpEvents() is thus put into an EventPump type, which can only be obtained through Sdl. This guarantees that the only way to call event-pumping functions is on the main thread.

Methods

impl Sdl
[src]

fn was_init(&self, flags: u32) -> u32

Returns the mask of the specified subsystems which have previously been initialized.

fn event_pump(&mut self) -> EventPump

Obtains the SDL event pump.

fn window(&self, title: &str, width: u32, height: u32) -> WindowBuilder

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

Trait Implementations

impl Drop for Sdl
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more