DSOL::Sprites::Palette Class Reference

a static class that manages empty sprite palettes. More...

#include <Palette.hpp>

List of all members.

Static Public Member Functions

static void copyPalette (const bool palettes16c, const bool paletteAmainOAM, const uint paletteAIndex, const bool paletteBmainOAM, const uint paletteBIndex)
 copies palette A to palette B.
static void copyPalette16c (const bool paletteAmainOAM, const uint paletteAIndex, const bool paletteBmainOAM, const uint paletteBIndex)
 copies 16 color palette A to palette B.
static void copyPalette256c (const bool paletteAmainOAM, const uint paletteAIndex, const bool paletteBmainOAM, const uint paletteBIndex)
 copies 16 color palette A to palette B.
static void freePalette (const bool mainOAM, const bool palette16c, const uint paletteIndex)
 frees a palette so other sprites can use it.
static uint reserveEmptyPalette (const bool mainOAM, const bool palette16c)
 reserves an empty palette to use.
static void writeToPalette (const bool mainOAM, const bool palette16c, const uint paletteIndex, const u16 *palettePointer, const uint paletteLength)
 copies the palette data for sprites into the right palette.
static void writeToPalette16c (const bool mainOAM, const uint paletteIndex, const u16 *palettePointer, const uint paletteLength)
 writes the palette data for 16 colored sprites into the right palette.
static void writeToPalette256c (const bool mainOAM, const uint paletteIndex, const u16 *palettePointer, const uint paletteLength)
 writes the palette data for 256 colored sprites into the right palette.

Static Public Attributes

static const uint NUMBER_OF_PALETTES = 16
 a constant for the number of palettes there are for each mode.


Detailed Description

a static class that manages empty sprite palettes.

Member Function Documentation

static void DSOL::Sprites::Palette::copyPalette ( const bool  palettes16c,
const bool  paletteAmainOAM,
const uint  paletteAIndex,
const bool  paletteBmainOAM,
const uint  paletteBIndex 
) [inline, static]

copies palette A to palette B.

both palettes must have the same color length(16 or 256).

Parameters:
palettes16c true if both palettes are for 16 color sprites, false for 256 color.
paletteAmainOAM true if palette A is for main OAM, false for sub OAM.
paletteAIndex the index of palette A.
paletteBmainOAM true if palette B is for main OAM, false for sub OAM.
paletteBIndex the index of palette B.

static void DSOL::Sprites::Palette::copyPalette16c ( const bool  paletteAmainOAM,
const uint  paletteAIndex,
const bool  paletteBmainOAM,
const uint  paletteBIndex 
) [static]

copies 16 color palette A to palette B.

Parameters:
paletteAmainOAM true if palette A is for main OAM, false for sub OAM.
paletteAIndex the index of palette A.
paletteBmainOAM true if palette B is for main OAM, false for sub OAM.
paletteBIndex the index of palette B.

static void DSOL::Sprites::Palette::copyPalette256c ( const bool  paletteAmainOAM,
const uint  paletteAIndex,
const bool  paletteBmainOAM,
const uint  paletteBIndex 
) [static]

copies 16 color palette A to palette B.

Parameters:
paletteAmainOAM true if palette A is for main OAM, false for sub OAM.
paletteAIndex the index of palette A.
paletteBmainOAM true if palette B is for main OAM, false for sub OAM.
paletteBIndex the index of palette B.

static void DSOL::Sprites::Palette::freePalette ( const bool  mainOAM,
const bool  palette16c,
const uint  paletteIndex 
) [static]

frees a palette so other sprites can use it.

this will free a palette that has been reserved with reserveEmptyPalette() so that other sprites can use it.

Parameters:
mainOAM true if the palette is for the main oam, false otherwise.
palette16c true if the palette needs to be for 16 color sprites, false for 256 color sprites.
paletteIndex the index to be freed, should be an index gotten with reserveEmptyPalette().

static uint DSOL::Sprites::Palette::reserveEmptyPalette ( const bool  mainOAM,
const bool  palette16c 
) [static]

reserves an empty palette to use.

this will check if there are palettes that hasn't been reserved yet, and reserves and returns it if there are onreserved palettes. there are 16 palettes for 16 color sprites and 16 palettes for 256 color sprites

Parameters:
mainOAM true if the palette is for the main oam, false otherwise
palette16c true if the palette needs to be for 16 color sprites, false for 256 color sprites
Returns:
the index of an unreserved palette (which has been reserved for you) or NUMBER_OF_PALETTES if there are no palettes left (will display an error in debug mode)

static void DSOL::Sprites::Palette::writeToPalette ( const bool  mainOAM,
const bool  palette16c,
const uint  paletteIndex,
const u16 *  palettePointer,
const uint  paletteLength 
) [inline, static]

copies the palette data for sprites into the right palette.

Parameters:
mainOAM true if the palette data will be used for main OAM, false for sub OAM.
palette16c true if the palette is for 16 color sprites, false for 256 color sprites.
paletteIndex the index to the palette, preferably obtained with using reserveEmptyPalette().
palettePointer a pointer to the palette data.
paletteLength the length of the data in bytes.

static void DSOL::Sprites::Palette::writeToPalette16c ( const bool  mainOAM,
const uint  paletteIndex,
const u16 *  palettePointer,
const uint  paletteLength 
) [static]

writes the palette data for 16 colored sprites into the right palette.

Parameters:
mainOAM true if the palette data will be used for main OAM, false for sub OAM.
paletteIndex the index to the palette, preferably obtained with using reserveEmptyPalette().
palettePointer a pointer to the palette data.
paletteLength the length of the data in bytes, must be 0 - 16*sizeof(u16).

static void DSOL::Sprites::Palette::writeToPalette256c ( const bool  mainOAM,
const uint  paletteIndex,
const u16 *  palettePointer,
const uint  paletteLength 
) [static]

writes the palette data for 256 colored sprites into the right palette.

Parameters:
mainOAM true if the palette data will be used for main OAM, false for sub OAM.
paletteIndex the index to the palette, preferably obtained with using reserveEmptyPalette().
palettePointer a pointer to the palette data.
paletteLength the length of the data in bytes, must be 0 - 256*sizeof(u16).


Member Data Documentation

a constant for the number of palettes there are for each mode.


The documentation for this class was generated from the following file:

Generated on Thu Sep 10 19:09:47 2009 for DSOL by  doxygen 1.5.8