diff --git a/agb/src/display/tiled/infinite_scrolled_map.rs b/agb/src/display/tiled/infinite_scrolled_map.rs index decdd4db..4021494b 100644 --- a/agb/src/display/tiled/infinite_scrolled_map.rs +++ b/agb/src/display/tiled/infinite_scrolled_map.rs @@ -1,6 +1,6 @@ use alloc::boxed::Box; -use super::{MapLoan, RegularMap, TileSet, TileSetting, VRamManager}; +use super::{BackgroundID, MapLoan, RegularMap, TileSet, TileSetting, VRamManager}; use crate::{ display, @@ -414,6 +414,11 @@ impl<'a> InfiniteScrolledMap<'a> { pub fn clear(&mut self, vram: &mut VRamManager) { self.map.clear(vram); } + + #[must_use] + pub const fn background(&self) -> BackgroundID { + self.map.background() + } } fn div_floor(x: i32, y: i32) -> i32 { diff --git a/agb/src/display/tiled/map.rs b/agb/src/display/tiled/map.rs index c1519e4e..b245ab23 100644 --- a/agb/src/display/tiled/map.rs +++ b/agb/src/display/tiled/map.rs @@ -7,7 +7,7 @@ use crate::dma::dma_copy16; use crate::fixnum::Vector2D; use crate::memory_mapped::MemoryMapped; -use super::{RegularBackgroundSize, Tile, TileSet, TileSetting, VRamManager}; +use super::{BackgroundID, RegularBackgroundSize, Tile, TileSet, TileSetting, VRamManager}; use alloc::{vec, vec::Vec}; @@ -201,6 +201,11 @@ impl<'a, T> MapLoan<'a, T> { screenblock_list, } } + + #[must_use] + pub const fn background(&self) -> BackgroundID { + BackgroundID(self.background_id) + } } impl<'a, T> Drop for MapLoan<'a, T> { diff --git a/agb/src/display/tiled/mod.rs b/agb/src/display/tiled/mod.rs index 37e2f445..529b8681 100644 --- a/agb/src/display/tiled/mod.rs +++ b/agb/src/display/tiled/mod.rs @@ -17,6 +17,9 @@ pub enum RegularBackgroundSize { Background64x64, } +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct BackgroundID(pub(crate) u8); + impl RegularBackgroundSize { #[must_use] pub fn width(&self) -> u32 {