mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Add a 256 colour variant too
This commit is contained in:
parent
bf4a6887a5
commit
da9ad6d496
|
@ -463,9 +463,16 @@ impl VRamManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the index of the colour for a given background palette, or None if it doesn't exist
|
/// Gets the index of the colour for a given background palette, or None if it doesn't exist
|
||||||
pub fn find_colour_index_16(&mut self, palette_index: usize, colour: u16) -> Option<usize> {
|
#[must_use]
|
||||||
|
pub fn find_colour_index_16(&self, palette_index: usize, colour: u16) -> Option<usize> {
|
||||||
assert!(palette_index < 16);
|
assert!(palette_index < 16);
|
||||||
|
|
||||||
(0..16).find(|i| PALETTE_BACKGROUND.get(palette_index * 16 + i) == colour)
|
(0..16).find(|i| PALETTE_BACKGROUND.get(palette_index * 16 + i) == colour)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the index of the colour in the entire background palette, or None if it doesn't exist
|
||||||
|
#[must_use]
|
||||||
|
pub fn find_colour_index_256(&self, colour: u16) -> Option<usize> {
|
||||||
|
(0..256).find(|&i| PALETTE_BACKGROUND.get(i) == colour)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue