Alchemy
Loading...
Searching...
No Matches

affine.h

Go to the documentation of this file.
1#ifndef ALCHEMY_AFFINE_H
2#define ALCHEMY_AFFINE_H
3
4/// @file
5/// Sprite rotation and scale, and the affine matrices handed out each frame.
6
8#include "types.h"
9#include "static_assert.h"
10
11/// A sprite's rotation and scale: scales in 8.8 fixed point (0x100 is full
12/// size), the angle in 1/65536 turns.
14 u16 scaleX; ///< 8.8 fixed point, read signed: negative mirrors the sprite
15 u16 scaleY; ///< 8.8 fixed point, read signed
16 u16 angle; ///< 1/65536 turns
17 u16 padding; ///< never read; keeps the struct 8 bytes
18};
19
20/// One OAM rotation-scaling matrix: pa, pb, pc and pd in 8.8 fixed point, the
21/// inverse of the transform the sprite is drawn with.
23 s16 coefficients[4]; ///< pa, pb, pc and pd
24 /// pa and pb, then pc and pd, written whole when only the diagonal is set.
26};
27
28STATIC_ASSERT(sizeof(struct AffineTransform) == 8);
31STATIC_ASSERT(sizeof(union AffineMatrix) == 8);
32
33/// The matrices handed out this frame (up to 32), copied into OAM with the
34/// sprites
35extern u8 gObjAffineCount;
36extern union AffineMatrix gObjAffineMatrices[];
37
38#endif
union AffineMatrix gObjAffineMatrices[]
u8 gObjAffineCount
The matrices handed out this frame (up to 32), copied into OAM with the sprites.
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
A sprite's rotation and scale: scales in 8.8 fixed point (0x100 is full size), the angle in 1/65536 t...
Definition affine.h:13
u16 padding
never read; keeps the struct 8 bytes
Definition affine.h:17
u16 angle
1/65536 turns
Definition affine.h:16
u16 scaleY
8.8 fixed point, read signed
Definition affine.h:15
u16 scaleX
8.8 fixed point, read signed: negative mirrors the sprite
Definition affine.h:14
The integer types, TRUE, UNUSED and the fixed-address macros.
unsigned int u32
Definition types.h:15
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
One OAM rotation-scaling matrix: pa, pb, pc and pd in 8.8 fixed point, the inverse of the transform t...
Definition affine.h:22
s16 coefficients[4]
pa, pb, pc and pd
Definition affine.h:23
u32 rows[2]
pa and pb, then pc and pd, written whole when only the diagonal is set.
Definition affine.h:25