From fde444e253f29c4f38ae5a701829cfbd3a5149c9 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Mon, 27 May 2024 14:42:53 +0100 Subject: [PATCH 1/2] Fix affine background matrix creation outside of the 1st quadrant --- agb/examples/affine_background.rs | 4 ++-- agb/src/display/affine.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/agb/examples/affine_background.rs b/agb/examples/affine_background.rs index d852238e..ae09643f 100644 --- a/agb/examples/affine_background.rs +++ b/agb/examples/affine_background.rs @@ -43,8 +43,8 @@ fn main(mut gba: agb::Gba) -> ! { loop { input.update(); - scroll_x += input.x_tri() as i32; - scroll_y += input.y_tri() as i32; + scroll_x += input.x_tri() as i16; + scroll_y += input.y_tri() as i16; let scroll_pos = (scroll_x, scroll_y); diff --git a/agb/src/display/affine.rs b/agb/src/display/affine.rs index 008b58ad..921d460d 100644 --- a/agb/src/display/affine.rs +++ b/agb/src/display/affine.rs @@ -298,11 +298,11 @@ impl AffineMatrixBackground { transform_origin: impl Into>>, scale: impl Into>>, rotation: Num, - position: impl Into>>, + position: impl Into>, ) -> Self { crate::syscall::bg_affine_matrix( transform_origin.into(), - position.into().try_change_base::().unwrap().floor(), + position.into(), scale.into().try_change_base().unwrap(), rotation.rem_euclid(1.into()).try_change_base().unwrap(), ) From 6b58280e81750ec040bfa9ed7869c1f405579fd7 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Mon, 27 May 2024 14:45:02 +0100 Subject: [PATCH 2/2] Add changelog entry for affine background positions --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 095a6e51..18180cad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `find_colour_index_16` and `find_colour_index_256` to the `VRamManager` to find where a colour is in a palette. +### Fixed + +- Affine background center position didn't work outside of the upper left quadrant of the gba's screen. + ## [0.20.2] - 2024/05/25 ### Fixed