Heap allocate drawing buffer

On some system it seems that the stack is quite small so now we heap
allocate the buffer instead. Also updated the docs and examples using
that instead of being on the stack. Bumped version to 0.2.4

Closes #8
This commit is contained in:
Daniel Collin 2016-01-05 21:29:52 +01:00
parent 57b734457e
commit 49eba1bc05
3 changed files with 6 additions and 6 deletions

View file

@ -12,7 +12,7 @@ Usage
```toml
# Cargo.toml
[dependencies]
minifb = "0.2.3"
minifb = "0.2.4"
```
Example
@ -25,7 +25,7 @@ const WIDTH: usize = 640;
const HEIGHT: usize = 360;
fn main() {
let mut buffer: [u32; WIDTH * HEIGHT] = [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, Scale::X1) {
Ok(win) => win,

View file

@ -1,6 +1,6 @@
extern crate minifb;
use minifb::*;
use minifb::{Window, Key, Scale};
const WIDTH: usize = 640;
const HEIGHT: usize = 360;
@ -10,7 +10,7 @@ fn main() {
let mut carry;
let mut seed = 0xbeefu32;
let mut buffer: [u32; WIDTH * HEIGHT] = [0; WIDTH * HEIGHT];
let mut buffer: Vec<u32> = vec![0; WIDTH * HEIGHT];
let mut window = match Window::new("Noise Test - Press ESC to exit", WIDTH, HEIGHT, Scale::X2) {
Ok(win) => win,

View file

@ -183,7 +183,7 @@ use self::os::unix as imp;
/// const WIDTH: usize = 640;
/// const HEIGHT: usize = 360;
///
/// let mut buffer: [u32; WIDTH * HEIGHT] = [0; WIDTH * HEIGHT];
/// let mut buffer: Vec<u32> = vec![0; WIDTH * HEIGHT];
///
/// let mut window = match Window::new("Test - Press ESC to exit", WIDTH, HEIGHT, Scale::X1).unwrap()
///
@ -222,7 +222,7 @@ impl Window {
/// # Examples
///
/// ```ignore
/// let mut buffer: [u32; 640 * 400] = [0; 640 * 400];
/// let mut buffer: Vec<u32> = vec![0; 640 * 400];
///
/// let mut window = match Window::new("Test", 640, 400, Scale::X1).unwrap();
///