libtonc: Tiled Backgrounds

Tonclib

Tiled Backgrounds
[Video]


Defines

#define CBB_CLEAR(cbb)   memset32(&tile_mem[cbb], 0, CBB_SIZE/4)
#define SBB_CLEAR(sbb)   memset32(&se_mem[sbb], 0, SBB_SIZE/4)
#define SBB_CLEAR_ROW(sbb, row)   memset32(&se_mem[sbb][(row)*32], 0, 32/2)
#define __BG_TYPES   ((0x0C7F<<16)|(0x0C40))
#define BG_IS_AFFINE(n)   ( (__BG_TYPES>>(4*(REG_DISPCNT&7)+(n) ))&1 )
#define BG_IS_AVAIL(n)   ( (__BG_TYPES>>(4*(REG_DISPCNT&7)+(n)+16))&1 )

Functions

INLINE void se_fill (SCR_ENTRY *sbb, SCR_ENTRY se)
 Fill screenblock sbb with se.
INLINE void se_plot (SCR_ENTRY *sbb, int x, int y, SCR_ENTRY se)
 Plot a screen entry at (x,y) of screenblock sbb.
INLINE void se_rect (SCR_ENTRY *sbb, int left, int top, int right, int bottom, SCR_ENTRY se)
 Fill a rectangle on sbb with se.
INLINE void se_frame (SCR_ENTRY *sbb, int left, int top, int right, int bottom, SCR_ENTRY se)
 Create a border on sbb with se.
void se_window (SCR_ENTRY *sbb, int left, int top, int right, int bottom, SCR_ENTRY se0)
 Create a framed rectangle.
void se_hline (SCR_ENTRY *sbb, int x0, int x1, int y, SCR_ENTRY se)
void se_vline (SCR_ENTRY *sbb, int x, int y0, int y1, SCR_ENTRY se)
INLINE void bg_aff_set (BG_AFFINE *bgaff, FIXED pa, FIXED pb, FIXED pc, FIXED pd)
 Set the elements of an bg affine matrix.
INLINE void bg_aff_identity (BG_AFFINE *bgaff)
 Set an bg affine matrix to the identity matrix.
INLINE void bg_aff_scale (BG_AFFINE *bgaff, FIXED sx, FIXED sy)
 Set an bg affine matrix for scaling.
INLINE void bg_aff_shearx (BG_AFFINE *bgaff, FIXED hx)
INLINE void bg_aff_sheary (BG_AFFINE *bgaff, FIXED hy)
void bg_aff_rotate (BG_AFFINE *bgaff, u16 alpha)
 Set bg matrix to counter-clockwise rotation.
void bg_aff_rotscale (BG_AFFINE *bgaff, int sx, int sy, u16 alpha)
 Set bg matrix to 2d scaling, then counter-clockwise rotation.
void bg_aff_premul (BG_AFFINE *dst, const BG_AFFINE *src)
 Pre-multiply dst by src: D = S*D.
void bg_aff_postmul (BG_AFFINE *dst, const BG_AFFINE *src)
 Post-multiply dst by src: D= D*S.
void bg_aff_rotscale2 (BG_AFFINE *bgaff, const AFF_SRC *as)
 Set bg matrix to 2d scaling, then counter-clockwise rotation.
void bg_rotscale_ex (BG_AFFINE *bgaff, const AFF_SRC_EX *asx)
 Set bg affine matrix to a rot/scale around an arbitrary point.

Define Documentation

#define CBB_CLEAR ( cbb   )     memset32(&tile_mem[cbb], 0, CBB_SIZE/4)


Function Documentation

void bg_aff_rotate ( BG_AFFINE bgaff,
u16  alpha 
)

Set bg matrix to counter-clockwise rotation.

Parameters:
bgaff Object affine struct to set.
alpha CCW angle. full-circle is 10000h.

void bg_aff_rotscale ( BG_AFFINE bgaff,
int  sx,
int  sy,
u16  alpha 
)

Set bg matrix to 2d scaling, then counter-clockwise rotation.

Parameters:
bgaff Object affine struct to set.
sx Horizontal scale (zoom). .8 fixed point.
sy Vertical scale (zoom). .8 fixed point.
alpha CCW angle. full-circle is 10000h.

void bg_aff_rotscale2 ( BG_AFFINE bgaff,
const AFF_SRC *  as 
)

Set bg matrix to 2d scaling, then counter-clockwise rotation.

Parameters:
bgaff Object affine struct to set.
as Struct with scales and angle.

void bg_rotscale_ex ( BG_AFFINE bgaff,
const AFF_SRC_EX *  asx 
)

Set bg affine matrix to a rot/scale around an arbitrary point.

Rotate and scale round an arbitrary point using the asx data.

Parameters:
bgaff BG affine data to set.
asx Affine source data: screen and texture origins, scales and angle.

void se_window ( SCR_ENTRY *  sbb,
int  left,
int  top,
int  right,
int  bottom,
SCR_ENTRY  se0 
)

Create a framed rectangle.

In contrast to se_frame(), se_frame_ex() uses nine tiles starting at se0 for the frame, which indicate the borders and center for the window.

Note:
Rectangle is nor normalized.


Generated on Mon Aug 25 17:03:57 2008 for libtonc by  doxygen 1.5.3