mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
add similar treatment to sprite palettes as background palettes
This commit is contained in:
parent
a3874e7140
commit
a39363b6ae
|
@ -274,11 +274,22 @@ impl Tiled0 {
|
|||
}
|
||||
|
||||
/// Copies raw palettes to the background palette without any checks.
|
||||
pub fn set_sprite_palette(&mut self, colour: &[u16]) {
|
||||
pub fn set_sprite_palette_raw(&mut self, colour: &[u16]) {
|
||||
for (index, &entry) in colour.iter().enumerate() {
|
||||
self.set_sprite_palette_entry(index.try_into().unwrap(), entry)
|
||||
}
|
||||
}
|
||||
fn set_sprite_palette(&mut self, pal_index: u8, palette: &palette16::Palette16) {
|
||||
for (colour_index, &colour) in palette.colours.iter().enumerate() {
|
||||
PALETTE_SPRITE.set(pal_index as usize * 16 + colour_index, colour);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_sprite_palettes(&mut self, palettes: &[palette16::Palette16]) {
|
||||
for (palette_index, entry) in palettes.iter().enumerate() {
|
||||
self.set_sprite_palette(palette_index as u8, entry)
|
||||
}
|
||||
}
|
||||
|
||||
/// Copies raw palettes to the background palette without any checks.
|
||||
pub fn set_background_palette_raw(&mut self, palette: &[u16]) {
|
||||
|
|
Loading…
Reference in a new issue