2015-11-23 05:00:35 +11:00
rust_minifb
2015-11-23 04:55:38 +11:00
======
2015-11-24 05:46:51 +11:00
rust_minifb (Mini FrameBuffer) is a small cross platform library written in [Rust ](https://www.rust-lang.org ) and that makes it easy to render (32-bit) pixels in a window. An example is the best way to show how it works:
2015-11-23 04:55:38 +11:00
2015-11-23 05:00:35 +11:00
```rust
extern crate minifb;
2015-11-23 04:55:38 +11:00
2015-12-25 20:37:13 +11:00
use minifb::*;
const WIDTH: usize = 640;
const HEIGHT: usize = 360;
2015-11-23 04:55:38 +11:00
2015-11-23 05:00:35 +11:00
fn main() {
let mut buffer: [u32; WIDTH * HEIGHT] = [0; WIDTH * HEIGHT];
2015-11-23 04:55:38 +11:00
2015-12-25 20:37:13 +11:00
let mut window = Window::new("Noise Test - Press ESC to exit",
WIDTH,
HEIGHT,
Scale::X1,
Vsync::No)
.unwrap();
2015-11-23 04:55:38 +11:00
2015-12-25 20:37:13 +11:00
while window.is_open() & & !window.is_key_down(Key::Escape) {
2015-11-23 05:00:35 +11:00
for i in buffer.iter_mut() {
2015-12-25 20:37:13 +11:00
*i = 0; // write something more funny here!
2015-11-23 05:00:35 +11:00
}
2015-11-23 04:55:38 +11:00
2015-12-25 20:37:13 +11:00
window.update(&buffer);
}
2015-11-23 05:01:34 +11:00
}
2015-11-23 05:00:35 +11:00
```
2015-11-23 04:55:38 +11:00
2015-11-24 05:46:51 +11:00
Status
------
2016-01-03 07:45:57 +11:00
Currently Windows and Mac are the current supported platforms. X11 (Linux/FreeBSD/etc) support is coming soon.
2015-11-24 05:46:51 +11:00
2015-12-25 20:37:13 +11:00
Build instruction
2015-11-23 04:55:38 +11:00
------------------
2015-11-24 05:27:18 +11:00
```
2015-11-23 05:00:35 +11:00
cargo build
2015-11-24 05:39:43 +11:00
cargo run --example noise
2015-11-24 05:27:18 +11:00
```
2015-11-24 05:26:27 +11:00
2015-12-25 20:37:13 +11:00
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)
2015-11-24 05:39:43 +11:00
2015-11-24 05:26:27 +11:00
![mac_screenshot ](https://dl.dropboxusercontent.com/u/5205843/rust_minifb/noise_screen.png )