added helpful functions

This commit is contained in:
Corwin Kuiper 2021-10-30 18:38:57 +01:00
parent ad82fe291f
commit d0808cb7f2
2 changed files with 8 additions and 1 deletions

View file

@ -12,7 +12,7 @@ const OBJECT_ATTRIBUTE_MEMORY: MemoryMapped1DArray<u16, 512> =
unsafe { MemoryMapped1DArray::new(0x0700_0000) }; unsafe { MemoryMapped1DArray::new(0x0700_0000) };
const PALETTE_SPRITE: MemoryMapped1DArray<u16, 256> = const PALETTE_SPRITE: MemoryMapped1DArray<u16, 256> =
unsafe { MemoryMapped1DArray::new(0x0500_0200) }; unsafe { MemoryMapped1DArray::new(0x0500_0200) };
const TILE_SPRITE: MemoryMapped1DArray<u32, { 512 * 8 }> = const TILE_SPRITE: MemoryMapped1DArray<u32, { 1024 * 8 }> =
unsafe { MemoryMapped1DArray::new(0x06010000) }; unsafe { MemoryMapped1DArray::new(0x06010000) };
/// Handles distributing objects and matricies along with operations that effect all objects. /// Handles distributing objects and matricies along with operations that effect all objects.
@ -331,6 +331,12 @@ impl ObjectControl {
} }
} }
pub fn set_sprite_tilemap_at_idx(&self, idx: usize, tiles: &[u32]) {
for (index, &tile) in tiles.iter().enumerate() {
self.set_sprite_tilemap_entry(index + idx, tile)
}
}
/// Enable objects on the GBA. /// Enable objects on the GBA.
pub fn enable(&mut self) { pub fn enable(&mut self) {
let disp = DISPLAY_CONTROL.get(); let disp = DISPLAY_CONTROL.get();

View file

@ -1,3 +1,4 @@
#[derive(Clone)]
pub struct Palette16 { pub struct Palette16 {
pub(crate) colours: [u16; 16], pub(crate) colours: [u16; 16],
} }