mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
repr packed
This commit is contained in:
parent
4eaf8af72f
commit
496b4a4953
|
@ -1198,7 +1198,7 @@ enum ColourMode {
|
||||||
/// This can be obtained from X/Y scale and rotation angle with
|
/// This can be obtained from X/Y scale and rotation angle with
|
||||||
/// [`agb::syscall::affine_matrix`].
|
/// [`agb::syscall::affine_matrix`].
|
||||||
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)]
|
||||||
#[repr(C)]
|
#[repr(C, packed)]
|
||||||
pub struct AffineMatrixAttributes {
|
pub struct AffineMatrixAttributes {
|
||||||
/// Adjustment made to *X* coordinate when drawing *horizontal* lines.
|
/// Adjustment made to *X* coordinate when drawing *horizontal* lines.
|
||||||
/// Also known as "dx".
|
/// Also known as "dx".
|
||||||
|
|
|
@ -139,7 +139,7 @@ pub fn arc_tan2(x: i16, y: i32) -> i16 {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C, packed)]
|
||||||
pub struct BgAffineSetData {
|
pub struct BgAffineSetData {
|
||||||
pub matrix: AffineMatrixAttributes,
|
pub matrix: AffineMatrixAttributes,
|
||||||
pub position: Vector2D<Num<i32, 8>>,
|
pub position: Vector2D<Num<i32, 8>>,
|
||||||
|
@ -180,11 +180,12 @@ pub fn bg_affine_matrix(
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
asm!(
|
asm!(
|
||||||
"swi {SWI}",
|
"swi {SWI}",
|
||||||
SWI = const { swi_map(0x0E) },
|
SWI = const { swi_map(0x0E) },
|
||||||
in("r0") &input as *const Input,
|
in("r0") &input as *const Input,
|
||||||
in("r1") output.as_mut_ptr(),
|
in("r1") output.as_mut_ptr(),
|
||||||
in("r2") 1,
|
in("r2") 1,
|
||||||
|
lateout("r3") _,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +236,9 @@ mod tests {
|
||||||
let one: Num<i16, 8> = 1.into();
|
let one: Num<i16, 8> = 1.into();
|
||||||
|
|
||||||
let aff = obj_affine_matrix((one, one).into(), Num::default());
|
let aff = obj_affine_matrix((one, one).into(), Num::default());
|
||||||
assert_eq!(aff.p_a, one);
|
let (p_a, p_d) = (aff.p_a, aff.p_d);
|
||||||
assert_eq!(aff.p_d, one);
|
|
||||||
|
assert_eq!(p_a, one);
|
||||||
|
assert_eq!(p_d, one);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue