move object out of tiled0

This commit is contained in:
Corwin Kuiper 2021-06-06 15:56:01 +01:00
parent 773e893421
commit 7e837fc3e8
4 changed files with 16 additions and 7 deletions

View file

@ -58,7 +58,7 @@ pub fn main() -> ! {
background.set_map(&MAP_MAP, 32, 32); background.set_map(&MAP_MAP, 32, 32);
background.show(); background.show();
let mut object = gfx.object; let mut object = gba.display.object.get();
object.enable(); object.enable();
let mut chicken = Character { let mut chicken = Character {

View file

@ -4,6 +4,8 @@ use bitflags::bitflags;
use vblank::VBlankGiver; use vblank::VBlankGiver;
use video::Video; use video::Video;
use self::object::ObjectControl;
/// Graphics mode 3. Bitmap mode that provides a 16-bit colour framebuffer. /// Graphics mode 3. Bitmap mode that provides a 16-bit colour framebuffer.
pub mod bitmap3; pub mod bitmap3;
/// Graphics mode 4. Bitmap 4 provides two 8-bit paletted framebuffers with page switching. /// Graphics mode 4. Bitmap 4 provides two 8-bit paletted framebuffers with page switching.
@ -62,6 +64,16 @@ enum DisplayMode {
pub struct Display { pub struct Display {
pub video: Video, pub video: Video,
pub vblank: VBlankGiver, pub vblank: VBlankGiver,
pub object: ObjectDistribution,
}
#[non_exhaustive]
pub struct ObjectDistribution {}
impl ObjectDistribution {
pub fn get(&mut self) -> ObjectControl {
ObjectControl::new()
}
} }
impl Display { impl Display {
@ -69,6 +81,7 @@ impl Display {
Display { Display {
video: Video {}, video: Video {},
vblank: VBlankGiver {}, vblank: VBlankGiver {},
object: ObjectDistribution {},
} }
} }
} }

View file

@ -365,8 +365,7 @@ impl ObjectControl {
mod tests { mod tests {
#[test_case] #[test_case]
fn get_and_release_object(gba: &mut crate::Gba) { fn get_and_release_object(gba: &mut crate::Gba) {
let gfx = gba.display.video.tiled0(); let objs = gba.display.object.get();
let objs = gfx.object;
let _o1 = { let _o1 = {
let o0 = objs.get_object_standard(); let o0 = objs.get_object_standard();
@ -384,8 +383,7 @@ mod tests {
#[test_case] #[test_case]
fn get_and_release_affine(gba: &mut crate::Gba) { fn get_and_release_affine(gba: &mut crate::Gba) {
let gfx = gba.display.video.tiled0(); let objs = gba.display.object.get();
let objs = gfx.object;
let _a1 = { let _a1 = {
let a0 = objs.get_affine(); let a0 = objs.get_affine();

View file

@ -248,7 +248,6 @@ impl Background<'_> {
pub struct Tiled0 { pub struct Tiled0 {
used_blocks: u32, used_blocks: u32,
num_backgrounds: u8, num_backgrounds: u8,
pub object: ObjectControl,
} }
impl Tiled0 { impl Tiled0 {
@ -258,7 +257,6 @@ impl Tiled0 {
Tiled0 { Tiled0 {
used_blocks: 0, used_blocks: 0,
num_backgrounds: 0, num_backgrounds: 0,
object: ObjectControl::new(),
} }
} }