Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

SpritesBase Class Reference

A sample base class for applications that use sprites. It handles dealing with the OAM on the NDS. More...

#include <Sprites.hpp>

List of all members.

Public Member Functions

void initOAM (void)
 Loops through all of the OAM entires turning the sprites off.

void updateOAM (void)
 Copy the internal OAM data to the real OAM memory.

 SpritesBase ()
 Simple constructor initializes internal variables.

int LoadSpriteData1D (uint32 oam_id, const uint16 *data, uint32 data_len, int *gfxid, int *gfxidsub=0)
 Loads the graphics data for the sprite into the OAM. Returns the gfxID for the sprite.

void MoveSprite (Sprite *sp)
 Updates the sprites attributes to move it's location as indicated by the current x/y coordinates for the sprite.

virtual ~SpritesBase ()
 Virtual destructor due to inheritance.

virtual uint32 displayCr (void) const
 Returns the value to OR (|) into other values related to these sprites.

virtual void reset (void)
 Resets the sprite loader back to base so that sprite graphic data can be reloaded into memory.


Public Attributes

SpriteEntry OAMCopy [128]
 Copy of the OAM memory for updating while the screen is being drawn. This copy is for the touch screen.

SpriteRotation * rotationData
 Overlay of the rotation data on top of the OAM. This rotation data is for the touch screen.

SpriteEntry OAMSubCopy [128]
 Copy of the OAM memory for updating while the screen is being drawn. This copy is for the top screen.

SpriteRotation * rotationSubData
 Overlay of the rotation data on top of the OAM. This rotation data is for the top screen.


Protected Attributes

uint32 gfx_id
 The gfxID for the next sprite loaded.

uint32 gfx_id_sub
 The gfxID for the next sprite loaded to the subscr.


Detailed Description

A sample base class for applications that use sprites. It handles dealing with the OAM on the NDS.


Member Function Documentation

void SpritesBase::updateOAM void   ) 
 

Copy the internal OAM data to the real OAM memory.

This can only be done during VBlank, or HBlank if specifically requested in the mode using H_BLANK_OAM.

int SpritesBase::LoadSpriteData1D uint32  oam_id,
const uint16 *  data,
uint32  data_len,
int *  gfxid,
int *  gfxidsub = 0
 

Loads the graphics data for the sprite into the OAM. Returns the gfxID for the sprite.

Parameters:
oam_id Controls which bank of oam to copy the graphics.
  • 1 -- The main sprite graphics (SPRITE_GFX)
  • 2 -- The sub sprite graphics (SPRITE_GFX_SUB)
  • 3 -- Both the main and sub sprite graphics.
data The graphic data to load into the OAM.
data_len The number of uint16 elements of the data to copy.
gfxid The gfxID to use to refer to the sprite.
gfxidsub The gfxID to use to refer to the sprite on the subscreen. Only required when oam_id is set to 3 because the gfxID values of the sprites may differ.
Return values:
0 An error of some sort prevented loading of graphics data.
1 The graphics loaded correctly.

void SpritesBase::MoveSprite Sprite sp  ) 
 

Updates the sprites attributes to move it's location as indicated by the current x/y coordinates for the sprite.

Parameters:
sp The sprite to move on the screen.


Member Data Documentation

SpriteEntry SpritesBase::OAMCopy[128]
 

Copy of the OAM memory for updating while the screen is being drawn. This copy is for the touch screen.

Copied during the VBlank (or sometimes the HBlank.)

SpriteRotation* SpritesBase::rotationData
 

Overlay of the rotation data on top of the OAM. This rotation data is for the touch screen.

Apparently, there are 128 sprites, but only 32 rotation entries. Each sprite can point to one of the 32 rotation entries.

SpriteEntry SpritesBase::OAMSubCopy[128]
 

Copy of the OAM memory for updating while the screen is being drawn. This copy is for the top screen.

Copied during the VBlank (or sometimes the HBlank.)

SpriteRotation* SpritesBase::rotationSubData
 

Overlay of the rotation data on top of the OAM. This rotation data is for the top screen.

Apparently, there are 128 sprites, but only 32 rotation entries. Each sprite can point to one of the 32 rotation entries.


The documentation for this class was generated from the following files:
Generated on Fri Apr 22 13:47:45 2005 for PhoenixRising NDS Library by doxygen 1.3.6