From 5c10af2f72899b5464107a7680a6d178b6c37835 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sat, 30 Oct 2021 21:16:40 +0100 Subject: [PATCH] Add methods for getting and setting a palette colour --- agb/src/display/palette16.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/agb/src/display/palette16.rs b/agb/src/display/palette16.rs index 0ad1ca17..f8a4bab2 100644 --- a/agb/src/display/palette16.rs +++ b/agb/src/display/palette16.rs @@ -7,4 +7,12 @@ impl Palette16 { pub const fn new(colours: [u16; 16]) -> Self { Palette16 { colours } } + + pub fn update_colour(&mut self, index: usize, colour: u16) { + self.colours[index] = colour; + } + + pub fn get_colour(&self, index: usize) -> u16 { + self.colours[index] + } }