mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Make example code a bit smaller
This commit is contained in:
parent
804f86a878
commit
219065a8c4
14
README.md
14
README.md
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue