From 32c6a5ce09efc511353b0f43931c9c7e106ec756 Mon Sep 17 00:00:00 2001 From: shivshank Date: Fri, 27 Jul 2018 22:06:53 -0400 Subject: [PATCH] Add example for black and white --- examples/black_and_white.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 examples/black_and_white.rs diff --git a/examples/black_and_white.rs b/examples/black_and_white.rs new file mode 100644 index 0000000..bd422cd --- /dev/null +++ b/examples/black_and_white.rs @@ -0,0 +1,20 @@ +extern crate mini_gl_fb; + +use mini_gl_fb::{Config, BufferFormat}; + +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() + }); + + fb.change_buffer_format::(BufferFormat::R); + fb.use_grayscale_shader(); + + let buffer = [128u8, 255, 50, 25]; + fb.update_buffer(&buffer); + + fb.persist_and_redraw(true); +}