From 933e504cef69da0a432819946891a800c31af57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com> Date: Wed, 6 Jul 2022 08:51:22 +0100 Subject: [PATCH] feat: new buffer strategy Allows WASM to run in a better way --- src/ppu.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ppu.rs b/src/ppu.rs index 5cd7c659..45091f78 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -27,7 +27,7 @@ pub type Pixel = [u8; RGB_SIZE]; /// should contain the pixel buffer of the tile. #[derive(Clone, Copy, PartialEq)] pub struct Tile { - pub buffer: [u8; 64], + buffer: [u8; 64], } impl Tile { @@ -38,6 +38,10 @@ impl Tile { pub fn set(&mut self, x: usize, y: usize, value: u8) { self.buffer[y * 8 + x] = value; } + + pub fn buffer(&self) -> Vec<u8> { + self.buffer.to_vec() + } } impl Display for Tile { -- GitLab