Minimal Starting Point
use sdl2::event::Event;
fn main() {
let sdl_context = sdl2::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();
let window = video_subsystem.window("Test", 1280, 720)
.position_centered()
.resizable()
.build()
.unwrap();
let mut canvas = window.into_canvas().build().unwrap();
let mut event_pump = sdl_context.event_pump().unwrap();
canvas.clear();
canvas.present();
'running: loop {
canvas.clear();
for event in event_pump.poll_iter() {
match event {
Event::Quit { .. } => {
break 'running
},
_ => {}
}
}
canvas.present();
}
}