Element example

This commit is contained in:
2025-07-01 03:14:36 +02:00
parent 9a626fb1bc
commit da934d9625
5 changed files with 68 additions and 8 deletions
+27
View File
@@ -0,0 +1,27 @@
pub struct RenderScope {
buffer: Vec<u32>,
width: usize,
height: usize,
}
impl RenderScope {
pub fn new(w: usize, h: usize) -> Self {
Self {
buffer: vec![0; w * h],
width: w,
height: h,
}
}
pub fn draw_rect(&mut self) {
for y in 0..200 {
for x in 0..200 {
self.buffer[y * self.height + x] = 0xFF00FF;
}
}
}
pub fn get_buffer(&self) -> Vec<u32> {
self.buffer.clone()
}
}