Struct sdl2::Sdl[][src]

pub struct Sdl { /* fields omitted */ }
Expand description

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.

Implementations

Initializes the audio subsystem.

Initializes the event subsystem.

Initializes the joystick subsystem.

Initializes the haptic subsystem.

Initializes the game controller subsystem.

Initializes the game controller subsystem.

Initializes the timer subsystem.

Initializes the video subsystem.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.