[][src]Struct sdl2::Sdl

pub struct Sdl { /* 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]

pub fn keyboard(&self) -> KeyboardUtil[src]

impl Sdl[src]

pub fn mouse(&self) -> MouseUtil[src]

impl Sdl[src]

pub fn audio(&self) -> Result<AudioSubsystem, String>[src]

Initializes the audio subsystem.

pub fn event(&self) -> Result<EventSubsystem, String>[src]

Initializes the event subsystem.

pub fn joystick(&self) -> Result<JoystickSubsystem, String>[src]

Initializes the joystick subsystem.

pub fn haptic(&self) -> Result<HapticSubsystem, String>[src]

Initializes the haptic subsystem.

pub fn game_controller(&self) -> Result<GameControllerSubsystem, String>[src]

Initializes the game controller subsystem.

pub fn timer(&self) -> Result<TimerSubsystem, String>[src]

Initializes the timer subsystem.

pub fn video(&self) -> Result<VideoSubsystem, String>[src]

Initializes the video subsystem.

pub fn event_pump(&self) -> Result<EventPump, String>[src]

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_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl !Send for Sdl

impl Unpin for Sdl

impl !Sync for Sdl

impl UnwindSafe for Sdl

impl !RefUnwindSafe for Sdl

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]