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-11-23 05:00:35 +11:00
const WIDTH: usize = 1280;
const HEIGHT: usize = 720;
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-11-23 05:00:35 +11:00
if !(minifb::open("TestWindow", WIDTH, HEIGHT)) {
return;
}
2015-11-23 04:55:38 +11:00
2015-11-23 05:00:35 +11:00
while minifb::update(& buffer) {
for i in buffer.iter_mut() {
*i = ... // write something here
}
}
2015-11-23 04:55:38 +11:00
2015-11-23 05:00:35 +11:00
minifb::close();
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
------
Currently Mac has been tested. Windows and Linux will be tested and verified soon.
2015-11-23 04:55:38 +11:00
Build instructions
------------------
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-11-24 05:39:43 +11:00
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)
2015-11-24 05:26:27 +11:00
![mac_screenshot ](https://dl.dropboxusercontent.com/u/5205843/rust_minifb/noise_screen.png )