Struct sdl2::sdl::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 init_subsystem(&self, flags: InitFlag) -> SdlResult<Subsystem>
Initializes specific SDL subsystems.
fn was_init(&self, flags: InitFlag) -> InitFlag
Returns the mask of the specified subsystems which have previously been initialized.
fn event_pump(&self) -> EventPump
Obtains the SDL event pump.