Sprite Class Referenceabstract

#include <Sprite.h>

Inheritance diagram for Sprite:
VisualComponent BgmapSprite ObjectSprite ObjectSpriteContainer FrameBlendBgmapSprite MBgmapSprite PrintingSprite TextObjectSprite

# Public Types

typedef const SpriteSpec SpriteROMSpec

# Public Member Functions

void constructor (Entity owner, const SpriteSpec *spriteSpec)
override void releaseResources ()
 Called to release the component's resources.
override RightBox getRightBox ()
override void createAnimationController ()
 Create an animation controller for this sprite.
override void forceChangeOfFrame (int16 actualFrame)
void transform ()
 Compute the sprite's transformation.
int16 render (int16 index, bool updateAnimation)
Texture getTexture ()
int16 getIndex ()
uint16 getHead ()
int32 getHalfWidth ()
int32 getHalfHeight ()
uint32 getEffectiveHead ()
uint16 getEffectiveWidth ()
uint16 getEffectiveHeight ()
int16 getEffectiveX ()
int16 getEffectiveY ()
int16 getEffectiveP ()
int16 getEffectiveMX ()
int16 getEffectiveMY ()
int16 getEffectiveMP ()
bool isVisible ()
bool isHidden ()
bool isBgmap ()
bool isObject ()
bool isAffine ()
bool isHBias ()
void setPosition (const PixelVector *position)
const PixelVectorgetPosition ()
 Retrieve the position cache.
void setDisplacement (const PixelVector *displacement)
const PixelVectorgetDisplacement ()
PixelVector getDisplacedPosition ()
void addChar (const Point *texturePoint, const uint32 *newChar)
void putChar (const Point *texturePoint, const uint32 *newChar)
void putPixel (const Point *texturePixel, const Pixel *charSetPixel, BYTE newPixelColor)
void invalidateRendering ()
 Invalidate the flags that determine if the sprite requires rendering.
virtual ClassPointer getBasicType ()=0
virtual void loadTexture (ClassPointer textureClass, bool listenForRewriting)
virtual void releaseTexture ()
 Release the sprite's texture(s)
virtual bool hasSpecialEffects ()
virtual int16 doRender (int16 index)=0
virtual void updateAnimation ()
 Update the animation.
virtual void processEffects (int32 maximumParamTableRowsToComputePerCall)
virtual void setMultiframe (uint16 frame)
virtual void forceShow ()
 Forcefully show the sprite.
virtual void forceHide ()
 Forcefully hide the sprite.
virtual void setRotation (const Rotation *rotation)
virtual void setScale (const PixelScale *scale)
virtual int32 getTotalPixels ()=0
virtual void print (int32 x, int32 y)

# Protected Attributes

bool checkIfWithinScreenSpace
 Flag to check if rendered even if outside the screen.
PixelVector position
 Position cache.
PixelVector displacement
 Displacement added to the sprite's position.
Rotation rotation
 Rotation cache.
int16 index
PixelScale scale
 Scale cache.
uint16 head
 Head flags for DRAM entries.
int16 halfWidth
 Cache of the texture's half width.
int16 halfHeight
 Cache of the texture's half height.
Texture texture
 Texture to display.
bool hasTextures
 Flag for special sprites.

# Additional Inherited Members

- Private Types inherited from VisualComponent
enum  VisualComponentCommands
typedef const AnimationFunction AnimationFunctionROMSpec
- Private Member Functions inherited from VisualComponent
void constructor (Entity owner, const VisualComponentSpec *visualComponentSpec)
override void handleCommand (int32 command, va_list args)
void show ()
 Make the visual component visible.
void hide ()
 Make the visual component invisible.
uint8 getTransparent ()
void setTransparency (uint8 transparency)
bool play (const char *animationName, ListenerObject scope)
bool replay ()
void pause (bool pause)
void stop ()
 Stop any playing animation if any.
bool isPlaying ()
bool isPlayingAnimation (char *animationName)
void nextFrame ()
 Skip the currently playing animation to the next frame.
void previousFrame ()
 Rewind the currently playing animation to the previous frame.
void setActualFrame (int16 actualFrame)
int16 getActualFrame ()
void setFrameDuration (uint8 frameDuration)
uint8 getFrameDuration ()
 Retrieve the duration in game cycles for each frame of animation.
void setFrameDurationDecrement (uint8 frameDurationDecrement)
const char * getPlayingAnimationName ()
AnimationController getAnimationController ()
- Private Attributes inherited from VisualComponent
AnimationController animationController
 Animation controller.
uint8 transparency
 Transparecy effect (__TRANSPARENCY_NONE, __TRANSPARENCY_EVEN or __TRANSPARENCY_ODD)
uint8 show
 Show state flag (__HIDE, __SHOW)
bool rendered
 Rendering status flag.
bool updateAnimationFrame
 Flag to allow/prohibit the update of the animation.

# Detailed Description

Class Sprite

Inherits from VisualComponent

Displays a Texture on the screen.

Definition at line 124 of file Sprite.h.

# Member Typedef Documentation

# SpriteROMSpec

typedef const SpriteSpec SpriteROMSpec

A Sprite spec that is stored in ROM

Definition at line 105 of file Sprite.h.

# Member Function Documentation

# addChar()

void Sprite::addChar ( const Point * texturePoint,
const uint32 * newChar )

Add the color provided color data to a CHAR in the sprite's texture.

Parameters
texturePointCoordinate in texture's space of the CHAR to replace
newCharColor data array for the CHAR

Definition at line 580 of file Sprite.c.

# constructor()

void Sprite::constructor ( Entity owner,
const SpriteSpec * spriteSpec )

Class' constructor

Parameters
ownerEntity to which the sprite attaches to
spriteSpecSpecification that determines how to configure the sprite

Definition at line 57 of file Sprite.c.

# createAnimationController()

void Sprite::createAnimationController ( )
virtual

Create an animation controller for this sprite.

Reimplemented from VisualComponent.

Definition at line 152 of file Sprite.c.

# doRender()

virtual int16 Sprite::doRender ( int16 index)
pure virtual

Render the sprite by configuring the DRAM assigned to it by means of the provided index.

Parameters
indexDetermines the region of DRAM that this sprite is allowed to configure
Returns
The index that determines the region of DRAM that this sprite manages

Implemented in BgmapSprite, FrameBlendBgmapSprite, MBgmapSprite, ObjectSprite, ObjectSpriteContainer, PrintingSprite, and TextObjectSprite.

# forceChangeOfFrame()

void Sprite::forceChangeOfFrame ( int16 actualFrame)
virtual

Force the change of frame according to each child class' implementation.

Parameters
actualFrameThe frame of the playing animation to skip to

Reimplemented from VisualComponent.

Definition at line 190 of file Sprite.c.

# forceHide()

void Sprite::forceHide ( )
virtual

Forcefully hide the sprite.

Definition at line 686 of file Sprite.c.

# forceShow()

void Sprite::forceShow ( )
virtual

Forcefully show the sprite.

Definition at line 677 of file Sprite.c.

# getBasicType()

virtual ClassPointer Sprite::getBasicType ( )
pure virtual

Retrieve the basic class of this kind of sprite.

Returns
ClassPointer the basic class

Implemented in BgmapSprite, ObjectSprite, and ObjectSpriteContainer.

# getDisplacedPosition()

PixelVector Sprite::getDisplacedPosition ( )

Retrieve the cached position plus the position displacement.

Returns
Cached position plus the position displacement

Definition at line 565 of file Sprite.c.

# getDisplacement()

const PixelVector * Sprite::getDisplacement ( )

Retrieve the position displacement.

Returns
Displacement added to the sprite's position

Definition at line 558 of file Sprite.c.

# getEffectiveHead()

uint32 Sprite::getEffectiveHead ( )

Retrieve the head flags written in the DRAM entries determined by index.

Returns
Head flags written to DRAM entries

Definition at line 371 of file Sprite.c.

# getEffectiveHeight()

uint16 Sprite::getEffectiveHeight ( )

Retrieve the height written in the DRAM entries determined by index.

Returns
Height written to DRAM entries

Definition at line 397 of file Sprite.c.

# getEffectiveMP()

int16 Sprite::getEffectiveMP ( )

Retrieve the MP value written in the DRAM entries determined by index.

Returns
MP value written to DRAM entries

Definition at line 475 of file Sprite.c.

# getEffectiveMX()

int16 Sprite::getEffectiveMX ( )

Retrieve the MX coordinate written in the DRAM entries determined by index.

Returns
MX coordinate written to DRAM entries

Definition at line 449 of file Sprite.c.

# getEffectiveMY()

int16 Sprite::getEffectiveMY ( )

Retrieve the MY coordinate written in the DRAM entries determined by index.

Returns
MY coordinate written to DRAM entries

Definition at line 462 of file Sprite.c.

# getEffectiveP()

int16 Sprite::getEffectiveP ( )

Retrieve the P value written in the DRAM entries determined by index.

Returns
P value written to DRAM entries

Definition at line 436 of file Sprite.c.

# getEffectiveWidth()

uint16 Sprite::getEffectiveWidth ( )

Retrieve the weight written in the DRAM entries determined by index.

Returns
Weight written to DRAM entries

Definition at line 384 of file Sprite.c.

# getEffectiveX()

int16 Sprite::getEffectiveX ( )

Retrieve the X coordinate written in the DRAM entries determined by index.

Returns
X coordinate written to DRAM entries

Definition at line 410 of file Sprite.c.

# getEffectiveY()

int16 Sprite::getEffectiveY ( )

Retrieve the Y coordinate written in the DRAM entries determined by index.

Returns
Y coordinate written to DRAM entries

Definition at line 423 of file Sprite.c.

# getHalfHeight()

int32 Sprite::getHalfHeight ( )

Retrieve the sprite's texture's half height.

Returns
Sprite's texture's half height

Definition at line 364 of file Sprite.c.

# getHalfWidth()

int32 Sprite::getHalfWidth ( )

Retrieve the sprite's texture's half weight.

Returns
Sprite's texture's half weight

Definition at line 357 of file Sprite.c.

# getHead()

uint16 Sprite::getHead ( )

Retrieve the head flags for DRAM entries.

Returns
Head flags for DRAM entries

Definition at line 350 of file Sprite.c.

# getIndex()

int16 Sprite::getIndex ( )

Retrieve the index that determines the region of DRAM that this sprite configured

Returns
The index that determines the region of DRAM that this sprite manages

Definition at line 343 of file Sprite.c.

# getPosition()

const PixelVector * Sprite::getPosition ( )

Retrieve the position cache.

Definition at line 543 of file Sprite.c.

# getRightBox()

RightBox Sprite::getRightBox ( )
virtual

Retrieve the sprite's bounding box.

Returns
Bounding box of the mesh

Reimplemented from Component.

Definition at line 127 of file Sprite.c.

# getTexture()

Texture Sprite::getTexture ( )

Retrieve the sprite's texture.

Returns
Texture displayed by the sprite

Definition at line 336 of file Sprite.c.

# getTotalPixels()

virtual int32 Sprite::getTotalPixels ( )
pure virtual

Retrieve the sprite's total number of pixels actually displayed.

Returns
Sprite's total number of pixels actually displayed

Implemented in BgmapSprite, ObjectSprite, and ObjectSpriteContainer.

# hasSpecialEffects()

bool Sprite::hasSpecialEffects ( )
virtual

Check if the sprite has special effects.

Returns
True if the sprite has special effects

Reimplemented in BgmapSprite.

Definition at line 646 of file Sprite.c.

# invalidateRendering()

void Sprite::invalidateRendering ( )

Invalidate the flags that determine if the sprite requires rendering.

Definition at line 638 of file Sprite.c.

# isAffine()

bool Sprite::isAffine ( )

Check if the sprite displays a texture in AFFINE mode.

Returns
True if the sprite displays a texture in AFFINE mode; false otherwise

Definition at line 516 of file Sprite.c.

# isBgmap()

bool Sprite::isBgmap ( )

Check if the sprite displays a texture in BGMAP mode.

Returns
True if the sprite displays a texture in BGMAP mode; false otherwise

Definition at line 502 of file Sprite.c.

# isHBias()

bool Sprite::isHBias ( )

Check if the sprite displays a texture in HBIAS mode.

Returns
True if the sprite displays a texture in HBIAS mode; false otherwise

Definition at line 523 of file Sprite.c.

# isHidden()

bool Sprite::isHidden ( )

Check if the sprite is hidden.

Returns
True if the sprite is hidden; false otherwise

Definition at line 495 of file Sprite.c.

# isObject()

bool Sprite::isObject ( )

Check if the sprite displays a texture in OBJECT mode.

Returns
True if the sprite displays a texture in OBJECT mode; false otherwise

Definition at line 509 of file Sprite.c.

# isVisible()

bool Sprite::isVisible ( )

Check if the sprite is visible.

Returns
True if the sprite is visible; false otherwise

Definition at line 488 of file Sprite.c.

# loadTexture()

void Sprite::loadTexture ( ClassPointer textureClass,
bool listenForRewriting )
virtual

Load a texture.

Parameters
textureClassClass of the texture to load
listenForRewritingIf true, a listener is added for the texture's rewriting event

Reimplemented in BgmapSprite, and ObjectSprite.

Definition at line 616 of file Sprite.c.

# print()

void Sprite::print ( int32 x,
int32 y )
virtual

Print the sprite's properties.

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

Definition at line 721 of file Sprite.c.

# processEffects()

void Sprite::processEffects ( int32 maximumParamTableRowsToComputePerCall)
virtual

Process special effects.

Parameters
maximumParamTableRowsToComputePerCallUsed to defer param table computations (-1 to compute the whole table)

Reimplemented in BgmapSprite.

Definition at line 667 of file Sprite.c.

# putChar()

void Sprite::putChar ( const Point * texturePoint,
const uint32 * newChar )

Replace a CHAR in the sprite's texture.

Parameters
texturePointCoordinate in texture's space of the CHAR to replace
newCharColor data array for the CHAR

Definition at line 592 of file Sprite.c.

# putPixel()

void Sprite::putPixel ( const Point * texturePixel,
const Pixel * charSetPixel,
BYTE newPixelColor )

Replace a pixel in the sprite's texture.

Parameters
texturePixelCoordinate in texture's space of the CHAR to replace
charSetPixelCoordinate in CHAR space of the CHAR to replace
newPixelColorColor data array for the CHAR

Definition at line 604 of file Sprite.c.

# releaseResources()

void Sprite::releaseResources ( )
virtual

Called to release the component's resources.

Reimplemented from Component.

Definition at line 103 of file Sprite.c.

# releaseTexture()

void Sprite::releaseTexture ( )
virtual

Release the sprite's texture(s)

Reimplemented in MBgmapSprite.

Definition at line 113 of file Sprite.c.

# render()

int16 Sprite::render ( int16 index,
bool updateAnimation )

Render the sprite by configuring the DRAM assigned to it by means of the provided index.

Parameters
indexDetermines the region of DRAM that this sprite is allowed to configure
updateAnimationIf false, animations are not updated
Returns
The index that determines the region of DRAM that this sprite manages

Definition at line 294 of file Sprite.c.

# setDisplacement()

void Sprite::setDisplacement ( const PixelVector * displacement)

Set the position displacement.

Parameters
displacementDisplacement added to the sprite's position

Definition at line 550 of file Sprite.c.

# setMultiframe()

void Sprite::setMultiframe ( uint16 frame)
virtual

Set the current multiframe.

Parameters
frameCurrent animation frame

Reimplemented in BgmapSprite, MBgmapSprite, and ObjectSprite.

Definition at line 672 of file Sprite.c.

# setPosition()

void Sprite::setPosition ( const PixelVector * position)

Set the position cache.

Parameters
positionPosition cache to save

Definition at line 530 of file Sprite.c.

# setRotation()

void Sprite::setRotation ( const Rotation * rotation)
virtual

Set the rotation cache.

Parameters
rotationRotation cache to save

Reimplemented in BgmapSprite, and ObjectSprite.

Definition at line 695 of file Sprite.c.

# setScale()

void Sprite::setScale ( const PixelScale * scale)
virtual

Set the scale cache.

Parameters
scaleScale cache to save

Reimplemented in BgmapSprite.

Definition at line 708 of file Sprite.c.

# transform()

void Sprite::transform ( )
inline

Compute the sprite's transformation.

Definition at line 201 of file Sprite.c.

# updateAnimation()

void Sprite::updateAnimation ( )
virtual

Update the animation.

Definition at line 653 of file Sprite.c.

# Member Data Documentation

# checkIfWithinScreenSpace

bool Sprite::checkIfWithinScreenSpace
protected

Flag to check if rendered even if outside the screen.

Definition at line 129 of file Sprite.h.

# displacement

PixelVector Sprite::displacement
protected

Displacement added to the sprite's position.

Definition at line 135 of file Sprite.h.

# halfHeight

int16 Sprite::halfHeight
protected

Cache of the texture's half height.

Definition at line 154 of file Sprite.h.

# halfWidth

int16 Sprite::halfWidth
protected

Cache of the texture's half width.

Definition at line 151 of file Sprite.h.

# hasTextures

bool Sprite::hasTextures
protected

Flag for special sprites.

Definition at line 160 of file Sprite.h.

# head

uint16 Sprite::head
protected

Head flags for DRAM entries.

Definition at line 148 of file Sprite.h.

# index

int16 Sprite::index
protected

Index of the block in DRAM that the sprite configures to display its texture

Definition at line 142 of file Sprite.h.

# position

void Sprite::position
protected

Position cache.

Definition at line 132 of file Sprite.h.

# rotation

Rotation Sprite::rotation
protected

Rotation cache.

Definition at line 138 of file Sprite.h.

# scale

void Sprite::scale
protected

Scale cache.

Definition at line 145 of file Sprite.h.

# texture

Texture Sprite::texture
protected

Texture to display.

Definition at line 157 of file Sprite.h.


The documentation for this class was generated from the following files:
  • VUEngine-Core/source/Component/VisualComponent/Sprite/Sprite.h
  • VUEngine-Core/source/Component/VisualComponent/Sprite/Sprite.c