From 4a74d885308d3727c56e7b52072b65e18d5e1cf4 Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Sun, 30 May 2021 19:57:07 +0100 Subject: [PATCH] affine is gettable --- agb/src/display/object.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/agb/src/display/object.rs b/agb/src/display/object.rs index 1a617be1..f13bc4f4 100644 --- a/agb/src/display/object.rs +++ b/agb/src/display/object.rs @@ -7,6 +7,7 @@ const OBJECT_ATTRIBUTE_MEMORY: MemoryMapped1DArray = #[non_exhaustive] pub struct ObjectControl { object_count: u8, + affine_count: u8, } pub struct ObjectStandard { @@ -165,7 +166,10 @@ impl ObjectControl { for index in 0..128 { unsafe { o.commit(index) }; } - ObjectControl { object_count: 0 } + ObjectControl { + object_count: 0, + affine_count: 0, + } } pub fn enable(&mut self) { @@ -189,4 +193,19 @@ impl ObjectControl { id, } } + + pub fn get_affine(&mut self) -> AffineMatrix { + let id = self.affine_count; + self.affine_count += 1; + assert!(id < 32, "affine id must be less than 32"); + AffineMatrix { + attributes: AffineMatrixAttributes { + p_a: 0, + p_b: 0, + p_c: 0, + p_d: 0, + }, + id, + } + } }