From b0f24913f0afdba28d4156b3e02b1388457f6b99 Mon Sep 17 00:00:00 2001 From: shivshank Date: Fri, 27 Jul 2018 18:01:34 -0400 Subject: [PATCH] Add example for scaled buffers --- examples/scaled_buffer.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/scaled_buffer.rs diff --git a/examples/scaled_buffer.rs b/examples/scaled_buffer.rs new file mode 100644 index 0000000..3571521 --- /dev/null +++ b/examples/scaled_buffer.rs @@ -0,0 +1,19 @@ +extern crate mini_gl_fb; + +use mini_gl_fb::Config; + +fn main() { + let mut fb = mini_gl_fb::get_fancy(Config { + window_title: "Hello world!", + window_size: (800.0, 600.0), + buffer_size: (2, 2), + .. Default::default() + }); + + let mut buffer = vec![[128u8, 0, 0, 255]; 4]; + buffer[3] = [255, 255, 255, 255]; + + fb.update_buffer(&buffer); + + fb.persist(); +}