[−][src]Struct sdl2::Sdl
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]
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
Auto Trait Implementations
impl !RefUnwindSafe for Sdl
impl !Send for Sdl
impl !Sync for Sdl
impl Unpin for Sdl
impl UnwindSafe for Sdl
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,