SpriteManager Class Reference

#include <SpriteManager.h>

Inheritance diagram for SpriteManager:
ComponentManager

# Public Member Functions

void constructor ()
 Class' constructor.
override bool onEvent (ListenerObject eventFirer, uint16 eventCode)
override uint32 getType ()
override void enable ()
 Enable the manager.
override void disable ()
 Disable the manager.
override Sprite create (Entity owner, const SpriteSpec *spriteSpec)
override void purgeComponents ()
 Force the purging of deleted components.
override bool areComponentsVisual ()
void configure (uint8 texturesMaximumRowsToWrite, int32 maximumParamTableRowsToComputePerCall, const int16 size[4], const int16 z[4], Clock animationsClock)
void setAnimationsClock (Clock animationsClock)
void setupObjectSpriteContainers (int16 size[4], int16 z[4])
void setMaximumParamTableRowsToComputePerCall (int32 maximumParamTableRowsToComputePerCall)
int32 getMaximumParamTableRowsToComputePerCall ()
void setTexturesMaximumRowsToWrite (uint8 texturesMaximumRowsToWrite)
int8 getTexturesMaximumRowsToWrite ()
void deferTextureUpdating (bool deferTextureUpdating)
void deferParamTableEffects (bool deferAffineTransformations)
void prepareAll ()
 Force the rendering and drawing of all sprites.
void render ()
 Render sprites.
void renderAndDraw ()
 Force the rendering and drawing of all sprites (available only when __TOOLS is defined).
void writeTextures ()
 Force the writing of graphical data to DRAM space.
void invalidateRendering ()
 Invalidate the rendering status of all sprites so they re-render again in the next cycle.
void hideAllSprites (Sprite spareSprite, bool hidePrinting)
void showAllSprites (Sprite spareSprite, bool showPrinting)
void hideAllSprites (Sprite spareSprite, bool hidePrinting)
void computeTotalPixelsDrawn ()
 Compute the total pixels drawn.
int8 getFreeLayer ()
int32 getNumberOfSprites ()
Sprite getSpriteAtIndex (int16 index)
void print (int32 x, int32 y, bool resumed)
void printSPTInfo (int16 spt, int32 x, int32 y)

# Protected Attributes

WorldAttributesworldAttributesBaseAddress
ObjectAttributesobjectAttributesBaseAddress
Clock animationsClock
 Clock for the animations.
SpriteRegistry spriteRegistry [kSpriteListEnd]
 List of all created sprites.
ObjectSpriteContainer objectSpriteContainers [4]
 List of object sprite containers.
int32 totalPixelsDrawn
 Total pixels currently drawn.
int16 maximumParamTableRowsToComputePerCall
 Number of param table rows to write during each rendering cycle.
bool evenFrame
 Flag to distinguish between even and odd game frames.
int16 bgmapIndex
 Free WORLD layer during the last rendering cycle.
int16 objectIndex
 Free OBJECT during the last rendering cycle.
int16 previousObjectIndex
int8 texturesMaximumRowsToWrite
 Number of texture rows to write during each rendering cycle.
bool deferTextureUpdating
 Flag to defer texturing writing over time.
bool deferParamTableEffects
 Flag to defer param tables writing over time.
bool completeSort
int8 spt
 SPT index that for OBJECT memory management.
uint16 vipSPTRegistersCache [4]
 Cache for the VIP SPT registers.

# Additional Inherited Members

- Private Member Functions inherited from ComponentManager
void constructor ()
 Class' constructor.
void destroyAllComponents ()
 Destroy all the manager's components.
virtual Component create (Entity owner, const ComponentSpec *componentSpec)=0
- Static Private Member Functions inherited from ComponentManager
static Component createComponent (Entity owner, const ComponentSpec *componentSpec)
static void destroyComponent (Entity owner, Component component)
static Component addComponent (Entity owner, const ComponentSpec *componentSpec)
static void removeComponent (Entity owner, Component component)
static void addComponents (Entity owner, ComponentSpec **componentSpecs, uint32 componentType)
static void removeComponents (Entity owner, uint32 componentType)
static void createComponents (Entity owner, ComponentSpec **componentSpecs)
static void destroyComponents (Entity owner)
static Component getComponentAtIndex (Entity owner, uint32 componentType, int16 componentIndex)
static void getComponents (Entity owner, uint32 componentType, VirtualList components)
static bool getComponentsOfClass (Entity owner, ClassPointer classPointer, VirtualList components, uint32 componentType)
static uint16 getComponentsCount (Entity owner, uint32 componentType)
static void propagateCommand (int32 command, Entity owner, uint32 componentType,...)
static bool calculateRightBox (Entity owner, RightBox *rightBox)
- Private Attributes inherited from ComponentManager
VirtualList components
 List of components.
bool locked
 Flag to prevent the manipulation of the components list.

# Detailed Description

Class SpriteManager

Inherits from ComponentManager

Manages all the sprite instances.

Definition at line 69 of file SpriteManager.h.

# Member Function Documentation

# areComponentsVisual()

bool SpriteManager::areComponentsVisual ( )
virtual

Retrieve information regarding if the components are visile.

Returns
True if the components managed are visual; false otherwise

Reimplemented from ComponentManager.

Definition at line 330 of file SpriteManager.c.

# computeTotalPixelsDrawn()

void SpriteManager::computeTotalPixelsDrawn ( )

Compute the total pixels drawn.

Definition at line 835 of file SpriteManager.c.

# configure()

void SpriteManager::configure ( uint8 texturesMaximumRowsToWrite,
int32 maximumParamTableRowsToComputePerCall,
const int16 size[4],
const int16 z[4],
Clock animationsClock )

Configure the manager's state.

Parameters
texturesMaximumRowsToWriteNumber of texture rows to write during each rendering cycle
maximumParamTableRowsToComputePerCallNumber of param table rows to write during each rendering cycle
sizeArray with the number of OBJECTS for each container
zArray of Z coordinates for each container
animationsClockClock for the animations

Definition at line 337 of file SpriteManager.c.

# constructor()

void SpriteManager::constructor ( )

Class' constructor.

Definition at line 76 of file SpriteManager.c.

# create()

Sprite SpriteManager::create ( Entity owner,
const SpriteSpec * spriteSpec )

Create a sprite with the provided spec.

Parameters
ownerObject to which the sprite will attach to
spriteSpecSpec to use to create the sprite
Returns
Created sprite

Definition at line 240 of file SpriteManager.c.

# deferParamTableEffects()

void SpriteManager::deferParamTableEffects ( bool deferAffineTransformations)

Enable or disable the writing of param tables over time.

Parameters
deferAffineTransformationsIf true, param tables are written overtime; otherwise they are written in a single pass

# deferTextureUpdating()

void SpriteManager::deferTextureUpdating ( bool deferTextureUpdating)

Enable or disable the texture writing over time.

Parameters
deferTextureUpdatingIf true, textures are written overtime; otherwise they are written in a single pass

# disable()

void SpriteManager::disable ( )
virtual

Disable the manager.

Reimplemented from ComponentManager.

Definition at line 208 of file SpriteManager.c.

# enable()

void SpriteManager::enable ( )
virtual

Enable the manager.

Reimplemented from ComponentManager.

Definition at line 168 of file SpriteManager.c.

# getFreeLayer()

int8 SpriteManager::getFreeLayer ( )

Retrieve the free WORLD layer during the last rendering cycle.

Returns
Free WORLD layer during the last rendering cycle

# getMaximumParamTableRowsToComputePerCall()

int32 SpriteManager::getMaximumParamTableRowsToComputePerCall ( )

Retrieve the number of param table rows to write during each rendering cycle.

Returns
Number of param table rows to write during each rendering cycle

Definition at line 472 of file SpriteManager.c.

# getNumberOfSprites()

int32 SpriteManager::getNumberOfSprites ( )

Retrieve the total number of registerd sprites.

Returns
Total number of registerd sprites

Definition at line 849 of file SpriteManager.c.

# getSpriteAtIndex()

Sprite SpriteManager::getSpriteAtIndex ( int16 index)

Retrieve the sprite at the provided position in the list of sprites.

Parameters
indexIndex of the node in the list of sprites
Returns
Sprite at the provided position in the list of sprites

Definition at line 856 of file SpriteManager.c.

# getTexturesMaximumRowsToWrite()

int8 SpriteManager::getTexturesMaximumRowsToWrite ( )

Get the number of texture rows to write during each rendering cycle.

Returns
Number of texture rows to write during each rendering cycle

Definition at line 486 of file SpriteManager.c.

# getType()

uint32 SpriteManager::getType ( )
virtual

Retrieve the compoment type that the manager manages.

Returns
Component type

Implements ComponentManager.

Definition at line 161 of file SpriteManager.c.

# hideAllSprites() [1/2]

void SpriteManager::hideAllSprites ( Sprite spareSprite,
bool hidePrinting )

Hide all sprites except the provided one.

Parameters
spareSpriteSprite to not hide
hidePrintingFlag to allow/prohibit the display of the printing sprite

# hideAllSprites() [2/2]

void SpriteManager::hideAllSprites ( Sprite spareSprite,
bool hidePrinting )

Hide all sprites except the provided one (available only when __TOOLS is defined).

Parameters
spareSpriteSprite to not hide
hidePrintingFlag to allow/prohibit the display of the printing sprite

# invalidateRendering()

void SpriteManager::invalidateRendering ( )

Invalidate the rendering status of all sprites so they re-render again in the next cycle.

Definition at line 746 of file SpriteManager.c.

# onEvent()

bool SpriteManager::onEvent ( ListenerObject eventFirer,
uint16 eventCode )
virtual

Process an event that the instance is listen for.

Parameters
eventFirerListenerObject that signals the event
eventCodeCode of the firing event
Returns
False if the listener has to be removed; true to keep it

Reimplemented from ListenerObject.

Definition at line 144 of file SpriteManager.c.

# prepareAll()

void SpriteManager::prepareAll ( )

Force the rendering and drawing of all sprites.

Definition at line 516 of file SpriteManager.c.

# print()

void SpriteManager::print ( int32 x,
int32 y,
bool resumed )

Print sprites statistics.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print
resumedIf true it only prints the most important statistics

Definition at line 915 of file SpriteManager.c.

# printSPTInfo()

void SpriteManager::printSPTInfo ( int16 spt,
int32 x,
int32 y )

Print OBJECT related stats.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 979 of file SpriteManager.c.

# purgeComponents()

void SpriteManager::purgeComponents ( )
virtual

Force the purging of deleted components.

Reimplemented from ComponentManager.

Definition at line 299 of file SpriteManager.c.

# render()

void SpriteManager::render ( )

Render sprites.

Definition at line 556 of file SpriteManager.c.

# renderAndDraw()

void SpriteManager::renderAndDraw ( )

Force the rendering and drawing of all sprites (available only when __TOOLS is defined).

# setAnimationsClock()

void SpriteManager::setAnimationsClock ( Clock animationsClock)

Set the clock that determines if the animations must be updated or not.

Parameters
clockClock for the animations

Definition at line 351 of file SpriteManager.c.

# setMaximumParamTableRowsToComputePerCall()

void SpriteManager::setMaximumParamTableRowsToComputePerCall ( int32 maximumParamTableRowsToComputePerCall)

Set the number of param table rows to write during each rendering cycle.

Parameters
maximumParamTableRowsToComputePerCallNumber of param table rows to write during each rendering cycle

Definition at line 465 of file SpriteManager.c.

# setTexturesMaximumRowsToWrite()

void SpriteManager::setTexturesMaximumRowsToWrite ( uint8 texturesMaximumRowsToWrite)

Set the number of texture rows to write during each rendering cycle.

Parameters
texturesMaximumRowsToWriteNumber of texture rows to write during each rendering cycle

Definition at line 479 of file SpriteManager.c.

# setupObjectSpriteContainers()

void SpriteManager::setupObjectSpriteContainers ( int16 size[4],
int16 z[4] )

Configure the object sprite containers.

Parameters
sizeArray with the number of OBJECTS for each container
zArray of Z coordinates for each container

# showAllSprites()

void SpriteManager::showAllSprites ( Sprite spareSprite,
bool showPrinting )

Show all sprites except the provided one (available only when __TOOLS is defined).

Parameters
spareSpriteSprite to not show
showPrintingFlag to allow/prohibit the display of the printing sprite

# writeTextures()

void SpriteManager::writeTextures ( )

Force the writing of graphical data to DRAM space.

Definition at line 735 of file SpriteManager.c.

# Member Data Documentation

# animationsClock

Clock SpriteManager::animationsClock
protected

Clock for the animations.

Definition at line 80 of file SpriteManager.h.

# bgmapIndex

int16 SpriteManager::bgmapIndex
protected

Free WORLD layer during the last rendering cycle.

Definition at line 98 of file SpriteManager.h.

# completeSort

bool SpriteManager::completeSort
protected

Definition at line 117 of file SpriteManager.h.

# deferParamTableEffects

void SpriteManager::deferParamTableEffects
protected

Flag to defer param tables writing over time.

Definition at line 114 of file SpriteManager.h.

# deferTextureUpdating

void SpriteManager::deferTextureUpdating
protected

Flag to defer texturing writing over time.

Definition at line 111 of file SpriteManager.h.

# evenFrame

bool SpriteManager::evenFrame
protected

Flag to distinguish between even and odd game frames.

Definition at line 95 of file SpriteManager.h.

# maximumParamTableRowsToComputePerCall

int16 SpriteManager::maximumParamTableRowsToComputePerCall
protected

Number of param table rows to write during each rendering cycle.

Definition at line 92 of file SpriteManager.h.

# objectAttributesBaseAddress

ObjectAttributes* SpriteManager::objectAttributesBaseAddress
protected

Definition at line 77 of file SpriteManager.h.

# objectIndex

int16 SpriteManager::objectIndex
protected

Free OBJECT during the last rendering cycle.

Definition at line 101 of file SpriteManager.h.

# objectSpriteContainers

ObjectSpriteContainer SpriteManager::objectSpriteContainers[4]
protected

List of object sprite containers.

Definition at line 86 of file SpriteManager.h.

# previousObjectIndex

int16 SpriteManager::previousObjectIndex
protected

Previous free OBJECT during the last rendering cycle, used to avoid writing the whole address space

Definition at line 105 of file SpriteManager.h.

# spriteRegistry

SpriteRegistry SpriteManager::spriteRegistry[kSpriteListEnd]
protected

List of all created sprites.

Definition at line 83 of file SpriteManager.h.

# spt

int8 SpriteManager::spt
protected

SPT index that for OBJECT memory management.

Definition at line 120 of file SpriteManager.h.

# texturesMaximumRowsToWrite

int8 SpriteManager::texturesMaximumRowsToWrite
protected

Number of texture rows to write during each rendering cycle.

Definition at line 108 of file SpriteManager.h.

# totalPixelsDrawn

int32 SpriteManager::totalPixelsDrawn
protected

Total pixels currently drawn.

Definition at line 89 of file SpriteManager.h.

# vipSPTRegistersCache

uint16 SpriteManager::vipSPTRegistersCache[4]
protected

Cache for the VIP SPT registers.

Definition at line 123 of file SpriteManager.h.

# worldAttributesBaseAddress

WorldAttributes* SpriteManager::worldAttributesBaseAddress
protected

Definition at line 74 of file SpriteManager.h.


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