mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
291d8a0441
Most of this was taken from #159. This does not include the API addition of adding a topmost call on Window. That should probably be in another PR. And the doc fixes as well. Used implementation from https://github.com/emoon/rust_minifb/pull/159#discussion_r401374050 Co-authored-by: phillvancejr <phillipvancejr@gmail.com> Co-authored-by: Daniel Collin <daniel@collin.com> Co-authored-by: phillvancejr <phillipvancejr@gmail.com> Co-authored-by: Daniel Collin <daniel@collin.com>
24 lines
582 B
Rust
24 lines
582 B
Rust
use minifb::{Key, ScaleMode, Window, WindowOptions};
|
|
|
|
fn main() {
|
|
// Allocate the output buffer.
|
|
let buf = vec![0x00FFFF00; 320 * 480];
|
|
|
|
let mut window = Window::new(
|
|
"Press ESC to exit",
|
|
320,
|
|
480,
|
|
WindowOptions {
|
|
resize: true,
|
|
scale_mode: ScaleMode::Center,
|
|
topmost: true,
|
|
..WindowOptions::default()
|
|
},
|
|
)
|
|
.expect("Unable to open Window");
|
|
|
|
while window.is_open() && !window.is_key_down(Key::Escape) {
|
|
window.update_with_buffer(&buf, 320, 480).unwrap();
|
|
}
|
|
}
|