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.
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 keyboard(&self) -> KeyboardUtil
impl Sdl
[src]
impl Sdl
[src]
fn audio(&self) -> SdlResult<AudioSubsystem>
Initializes the audio subsystem.
fn event(&self) -> SdlResult<EventSubsystem>
Initializes the event subsystem.
fn joystick(&self) -> SdlResult<JoystickSubsystem>
Initializes the joystick subsystem.
fn haptic(&self) -> SdlResult<HapticSubsystem>
Initializes the haptic subsystem.
fn game_controller(&self) -> SdlResult<GameControllerSubsystem>
Initializes the game controller subsystem.
fn timer(&self) -> SdlResult<TimerSubsystem>
Initializes the timer subsystem.
fn video(&self) -> SdlResult<VideoSubsystem>
Initializes the video subsystem.
fn event_pump(&self) -> SdlResult<EventPump>
Obtains the SDL event pump.
At most one EventPump
is allowed to be alive during the program's execution.
If this function is called while an EventPump
instance is alive, the function will return
an error.
Trait Implementations
impl Clone for Sdl
[src]
fn clone(&self) -> Sdl
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more