From aa38a03ac98c88b386f68504920751702376715a Mon Sep 17 00:00:00 2001 From: Corwin Date: Sat, 24 Jun 2023 16:17:32 +0100 Subject: [PATCH] add read pixel method --- agb/src/display/bitmap3.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/agb/src/display/bitmap3.rs b/agb/src/display/bitmap3.rs index 2674d47e..b29b3177 100644 --- a/agb/src/display/bitmap3.rs +++ b/agb/src/display/bitmap3.rs @@ -30,4 +30,19 @@ impl Bitmap3<'_> { let y = y.try_into().unwrap(); BITMAP_MODE_3.set(x, y, colour); } + + #[must_use] + pub fn read_point(&self, x: i32, y: i32) -> u16 { + let x = x.try_into().unwrap(); + let y = y.try_into().unwrap(); + BITMAP_MODE_3.get(x, y) + } + + pub fn clear(&mut self, colour: u16) { + for y in 0..(HEIGHT as usize) { + for x in 0..(WIDTH as usize) { + BITMAP_MODE_3.set(x, y, colour); + } + } + } }