Merge pull request #63 from corwinkuiper/split-object

move object out of tiled0
This commit is contained in:
Corwin 2021-06-06 16:18:18 +01:00 committed by GitHub
commit 342aac005c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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.show();
let mut object = gfx.object;
let mut object = gba.display.object.get();
object.enable();
let mut chicken = Character {

View file

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

View file

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

View file

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