Added windows support and made example render something fancier
This commit is contained in:
parent
a36b11a934
commit
d89a0c92aa
4 changed files with 88 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue