mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-11 03:21:32 +11:00
Proper error handling if window create fail
This commit is contained in:
parent
867daf1ca9
commit
66c36fb6c6
|
@ -12,11 +12,13 @@ fn main() {
|
|||
|
||||
let mut buffer: [u32; WIDTH * HEIGHT] = [0; WIDTH * HEIGHT];
|
||||
|
||||
let mut window = Window::new("Noise Test - Press ESC to exit",
|
||||
WIDTH,
|
||||
HEIGHT,
|
||||
Scale::X2)
|
||||
.unwrap();
|
||||
let mut window = match Window::new("Noise Test - Press ESC to exit", WIDTH, HEIGHT, Scale::X2) {
|
||||
Ok(win) => win,
|
||||
Err(err) => {
|
||||
println!("Unable to create window {}", err);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
while window.is_open() && !window.is_key_down(Key::Escape) {
|
||||
for i in buffer.iter_mut() {
|
||||
|
|
Loading…
Reference in a new issue