Updated README with correct example

This commit is contained in:
Daniel Collin 2015-12-25 10:37:13 +01:00
parent ab849a63d4
commit c5aca23e78

View file

@ -7,32 +7,37 @@ rust_minifb (Mini FrameBuffer) is a small cross platform library written in [Rus
```rust ```rust
extern crate minifb; extern crate minifb;
const WIDTH: usize = 1280; use minifb::*;
const HEIGHT: usize = 720;
const WIDTH: usize = 640;
const HEIGHT: usize = 360;
fn main() { fn main() {
let mut buffer: [u32; WIDTH * HEIGHT] = [0; WIDTH * HEIGHT]; let mut buffer: [u32; WIDTH * HEIGHT] = [0; WIDTH * HEIGHT];
if !(minifb::open("TestWindow", WIDTH, HEIGHT)) { let mut window = Window::new("Noise Test - Press ESC to exit",
return; WIDTH,
} HEIGHT,
Scale::X1,
Vsync::No)
.unwrap();
while minifb::update(&buffer) { while window.is_open() && !window.is_key_down(Key::Escape) {
for i in buffer.iter_mut() { for i in buffer.iter_mut() {
*i = ... // write something here *i = 0; // write something more funny here!
} }
}
minifb::close(); window.update(&buffer);
}
} }
``` ```
Status Status
------ ------
Currently Mac, Windows has been Linux has been tested which are the supported platforms for now. Currently Windows is the supported platform.
Build instructions Build instruction
------------------ ------------------
``` ```
@ -40,6 +45,6 @@ cargo build
cargo run --example noise cargo run --example noise
``` ```
This will run the [noise example](https://github.com/emoon/rust_minifb/blob/master/examples/noise.rs) which should look something like this (Mac screenshot) This will run the [noise example](https://github.com/emoon/rust_minifb/blob/windows-rs/examples/noise.rs) which should look something like this (Mac screenshot)
![mac_screenshot](https://dl.dropboxusercontent.com/u/5205843/rust_minifb/noise_screen.png) ![mac_screenshot](https://dl.dropboxusercontent.com/u/5205843/rust_minifb/noise_screen.png)