Added windows support and made example render something fancier

This commit is contained in:
David Johnson 2022-01-16 08:03:20 -06:00
parent a36b11a934
commit d89a0c92aa
4 changed files with 88 additions and 3 deletions

View file

@ -17,7 +17,17 @@ fn main() {
let size = graphics_context.window().inner_size();
(size.width, size.height)
};
let buffer = vec![0x00FF00FF; (width * height) as usize];
let buffer = (0..((width*height) as usize)).map(|index|{
let y = index / (width as usize);
let x = index % (width as usize);
let red = x % 255;
let green = y % 255;
let blue = (x*y) % 255;
let color = blue | (green << 8) | (red << 16);
color as u32
}).collect::<Vec<_>>();
graphics_context.set_buffer(&buffer, width as u16, height as u16);
}