The previous example created a window and drew into it. Now let's see how it did that!
Before going any further, we need to import the SDL2 crate, as follows:
extern crate sdl2;
With this, we now have access to everything it contains.
Now that we've imported sdl2, we need to initialize an SDL context:
let sdl_context = sdl2::init().expect("SDL initialization failed");
Once done, we need to get the video subsystem:
let video_subsystem = sdl_context.video().expect("Couldn't get SDL
video subsystem");
We can now create the window:
let window = video_subsystem.window("Tetris", 800, 600) .position_centered()
.opengl() .build() .expect("Failed to create window");
A few notes on...