diff --git a/agb/examples/text_render.rs b/agb/examples/text_render.rs index b4d87a34..4f0afa18 100644 --- a/agb/examples/text_render.rs +++ b/agb/examples/text_render.rs @@ -8,7 +8,6 @@ use agb::{ }, include_font, }; -use modular_bitfield::private::checks::FourMod8; use core::fmt::Write; diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index e802ea43..ea1cdac4 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -195,6 +195,14 @@ impl RegularMap { tileset: &TileSet<'_>, tile_setting: TileSetting, ) { + if tileset.format() != self.colours() { + panic!( + "Cannot set a {:?} colour tile on a {:?} colour background", + tileset.format(), + self.colours() + ); + } + let pos = self.map_size().gba_offset(pos); let old_tile = self.tiles_mut()[pos]; diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index 3464f54e..f98673b9 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -57,6 +57,10 @@ impl<'a> TileSet<'a> { fn reference(&self) -> NonNull<[u8]> { self.tiles.into() } + + pub(crate) fn format(&self) -> TileFormat { + self.format + } } #[derive(Debug, Clone, Copy)]