From b50d6694d951e3bcffd9fcb7bd4bce12b1544bb8 Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Mon, 9 Jan 2023 11:27:00 +0000 Subject: [PATCH] Add missing methods for tiled1 to allow creating backgrounds Fixes #367 --- agb/src/display/tiled/tiled1.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/agb/src/display/tiled/tiled1.rs b/agb/src/display/tiled/tiled1.rs index 84903aa2..6126e46a 100644 --- a/agb/src/display/tiled/tiled1.rs +++ b/agb/src/display/tiled/tiled1.rs @@ -1,9 +1,13 @@ use core::cell::RefCell; -use super::{CreatableAffineTiledMode, CreatableRegularTiledMode, TiledMode}; +use super::{ + AffineBackgroundSize, AffineMap, AffineTiledMode, CreatableAffineTiledMode, + CreatableRegularTiledMode, MapLoan, RegularBackgroundSize, RegularMap, RegularTiledMode, + TiledMode, +}; use crate::{ bitarray::Bitarray, - display::{set_graphics_mode, tiled::AFFINE_BG_ID_OFFSET, DisplayMode}, + display::{set_graphics_mode, tiled::AFFINE_BG_ID_OFFSET, DisplayMode, Priority}, }; pub struct Tiled1 { @@ -27,6 +31,18 @@ impl Tiled1 { screenblocks: Default::default(), } } + + pub fn regular( + &self, + priority: Priority, + size: RegularBackgroundSize, + ) -> MapLoan<'_, RegularMap> { + self.regular_background(priority, size) + } + + pub fn affine(&self, priority: Priority, size: AffineBackgroundSize) -> MapLoan<'_, AffineMap> { + self.affine_background(priority, size) + } } impl TiledMode for Tiled1 {