The SGADE Documentation

the SGADE The Socrates Gameboy Advance Development Engine

The SGADE is a development library for the Nintendo Gameboy Advance. It's free for all uses and is distributed without guarantees. For more information visit the SGADE page.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoTileSet

Module for handling sets of 8 by 8 pixel tiles. More...

Files

file  SoTileSet.c
file  SoTileSet.h

Data Structures

struct  SoTileSet
 Tileset structure. More...


Defines

#define SoTileSetGetNumTiles(a_This)
 Returns the number of tiles in the TileSet.

#define SoTileSetIs16Colors(a_This)
 Tests whether the tileset is palettized or not (returns true if palettized).

#define SoTileSetGetData(a_This)
 Returns the actual texture data of the tileset.


Functions

u32 SoTileSetGetSize (const SoTileSet *a_This)
 To get the size of the entire tileset.

void SoTileSetBkgLoad (const SoTileSet *a_This, u32 a_CharBase, u32 a_BaseIdx)
 Loads tile data into background VRAM.

void SoTileSetCopyFromLinearBuffer (u32 *source, u32 *dest, u32 width, u32 height)
 Copy a linear buffer to sprite format, which is organised in a linear array of 8*8 blocks.


Detailed Description

Module for handling sets of 8 by 8 pixel tiles.

A tile is an 8x8 square of palettized pixels. Either referring to a 16 color palette, or a 256 color palette.

You can use the SoConverter tool to convert images to tilesets.


Function Documentation

void SoTileSetBkgLoad const SoTileSet   a_This,
u32    a_CharBase,
u32    a_BaseIdx
 

Loads tile data into background VRAM.

Parameters:
a_This  this pointer
a_CharBase  charbase bank (0-3)
a_BaseIdx  index value of first tile to copy from SoTileSet

void SoTileSetCopyFromLinearBuffer u32   source,
u32   dest,
u32    width,
u32    height
 

Copy a linear buffer to sprite format, which is organised in a linear array of 8*8 blocks.

Parameters:
source  the start of the linear buffer in iwram
source  the start of the linear buffer in iwram
dest  the start of the sprite in vram
width  the width of the iwram buffer in pixels
height  the width of the iwram buffer in pixels
This function is located in iwram

For optimal performance, make sure the source buffer is in iwram If your destination buffer is in vram, make sure to only use this in vblank, since the accestimes to vram are undefined while refreshing the display

This function takes ~ 2% cpu time for a 64*64 sprite

u32 SoTileSetGetSize const SoTileSet   a_This
 

To get the size of the entire tileset.

Parameters:
a_This  This pointer
Returns :
The size of the entire tileset in bytes.
Because a single tile is 8x8, an entire tileset is the number of tiles times 8 times 8 bytes big. Unless they are 4-bit palettized (16 color tiles), cause then this value needs to be divided by two, cause there's two pixels in each byte.


Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.