Make example code a bit smaller

This commit is contained in:
Daniel Collin 2016-09-18 10:25:08 +02:00
parent 804f86a878
commit 219065a8c4

View file

@ -31,14 +31,12 @@ const HEIGHT: usize = 360;
fn main() { fn main() {
let mut buffer: Vec<u32> = vec![0; WIDTH * HEIGHT]; let mut buffer: Vec<u32> = vec![0; WIDTH * HEIGHT];
let mut window = match minifb::Window::new("Test - ESC to exit", WIDTH, HEIGHT, let mut window = Window::new("Test - ESC to exit",
WindowOptions::default()) { WIDTH,
Ok(win) => win, HEIGHT,
Err(err) => { WindowOptions::default()).unwrap_or_else(|e| {
println!("Unable to create window {}", err); panic!("{}", e);
return; });
}
};
while window.is_open() && !window.is_key_down(Key::Escape) { while window.is_open() && !window.is_key_down(Key::Escape) {
for i in buffer.iter_mut() { for i in buffer.iter_mut() {