Function sdl2::init [] [src]

pub fn init() -> Result<Sdl, String>

Initializes the SDL library. This must be called before using any other SDL function.

Example

let sdl_context = sdl2::init().unwrap();
let mut event_pump = sdl_context.event_pump().unwrap();

for event in event_pump.poll_iter() {
    // ...
}

// SDL_Quit() is called here as `sdl_context` is dropped.