Fix affine background matrix creation outside of the 1st quadrant (#714)

- [x] Changelog updated
This commit is contained in:
Gwilym Inzani 2024-05-27 16:46:59 +01:00 committed by GitHub
commit 2de07342d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 4 deletions

View file

@ -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. - 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 ## [0.20.2] - 2024/05/25
### Fixed ### Fixed

View file

@ -43,8 +43,8 @@ fn main(mut gba: agb::Gba) -> ! {
loop { loop {
input.update(); input.update();
scroll_x += input.x_tri() as i32; scroll_x += input.x_tri() as i16;
scroll_y += input.y_tri() as i32; scroll_y += input.y_tri() as i16;
let scroll_pos = (scroll_x, scroll_y); let scroll_pos = (scroll_x, scroll_y);

View file

@ -298,11 +298,11 @@ impl AffineMatrixBackground {
transform_origin: impl Into<Vector2D<Num<i32, 8>>>, transform_origin: impl Into<Vector2D<Num<i32, 8>>>,
scale: impl Into<Vector2D<Num<i32, 8>>>, scale: impl Into<Vector2D<Num<i32, 8>>>,
rotation: Num<i32, 16>, rotation: Num<i32, 16>,
position: impl Into<Vector2D<Num<i32, 8>>>, position: impl Into<Vector2D<i16>>,
) -> Self { ) -> Self {
crate::syscall::bg_affine_matrix( crate::syscall::bg_affine_matrix(
transform_origin.into(), transform_origin.into(),
position.into().try_change_base::<i16, 8>().unwrap().floor(), position.into(),
scale.into().try_change_base().unwrap(), scale.into().try_change_base().unwrap(),
rotation.rem_euclid(1.into()).try_change_base().unwrap(), rotation.rem_euclid(1.into()).try_change_base().unwrap(),
) )