Texture Class Reference

#include <Texture.h>

Inheritance diagram for Texture:
ListenerObject BgmapTexture ObjectTexture

# Public Types

enum  TextureStatus
typedef const TextureSpec TextureROMSpec

# Public Member Functions

void constructor (const TextureSpec *textureSpec, uint16 id)
override bool onEvent (ListenerObject eventFirer, uint16 eventCode)
uint16 getId ()
void setSpec (TextureSpec *textureSpec)
const TextureSpecgetSpec ()
CharSet getCharSet (uint32 loadIfNeeded)
void increaseUsageCount ()
 Increase the usage count.
bool decreaseUsageCount ()
 Decrease the usage count.
int8 getUsageCount ()
void setPalette (uint8 palette)
uint8 getPalette ()
uint32 getNumberOfFrames ()
void setFrame (uint16 frame)
uint16 getFrame ()
uint32 getCols ()
uint32 getRows ()
bool isWritten ()
bool isShared ()
bool isAnimated ()
bool isSingleFrame ()
bool isMultiframe ()
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 prepare ()
bool update (int16 maximumTextureRowsToWrite)
virtual bool write (int16 maximumTextureRowsToWrite)
virtual void rewrite ()
 Rewrite graphical data to the allocated DRAM space.

# Static Private Member Functions

static Texture get (ClassPointer textureClass, const TextureSpec *textureSpec, int16 minimumSegment, bool mustLiveAtEvenSegment, uint32 scValue)
static void release (Texture texture)
static void updateTextures (int16 maximumTextureRowsToWrite, bool defer)
static uint32 getTotalCols (TextureSpec *textureSpec)
static uint32 getTotalRows (TextureSpec *textureSpec)

# Private Attributes

void(* doUpdate )(Texture, int16)
 Pointer to the implementation that updates graphical data in DRAM.
CharSet charSet
 Char set that holds the pixel data used by the texture.
const TextureSpectextureSpec
 Spec used to configure the texture.
uint32 mapDisplacement
 Displacement inside the map array modified according to the frame's value.
uint16 id
 Identificator.
uint16 frame
 Indicator of the block inside the map array to write to DRAM.
uint8 palette
 Palette index to use by the graphical data.
uint8 status
 Writing status flag.
int8 usageCount
 Number of references to this texture instance.
bool update
 Flag to signal that the texture needs to update DRAM in the next render cycle.
- Private Attributes inherited from ListenerObject
VirtualList events
 List of registered events.
int8 eventFirings
 Counter that keeps track of the number of fired events to prevent race conditions in nested firings.

# Additional Inherited Members

- Private Member Functions inherited from ListenerObject
void constructor ()
 Class' constructor.
void destructor ()
 Class' destructor.
void addEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListener (ListenerObject listener, uint16 eventCode)
void removeEventListeners (uint16 eventCode)
void removeAllEventListeners ()
 Remove all listener objects.
bool hasActiveEventListeners ()
void fireEvent (uint16 eventCode)
void sendMessageTo (ListenerObject receiver, uint32 message, uint32 delay, uint32 randomDelay)
void sendMessageToSelf (uint32 message, uint32 delay, uint32 randomDelay)
void discardAllMessages ()
 Discard all messages, both to be sent and to be received.
void discardMessages (uint32 message)
virtual bool handleMessage (Telegram telegram)

# Detailed Description

Class CharSet

Inherits from ListenerObject

A texture to be displayed by a sprite.

Definition at line 90 of file Texture.h.

# Member Typedef Documentation

# TextureROMSpec

typedef const TextureSpec TextureROMSpec

A Texture spec that is stored in ROM

Definition at line 79 of file Texture.h.

# Member Enumeration Documentation

# TextureStatus

Definition at line 31 of file Texture.h.

# Member Function Documentation

# addChar()

void Texture::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 467 of file Texture.c.

# constructor()

void Texture::constructor ( const TextureSpec * textureSpec,
uint16 id )

Class' constructor

Parameters
textureSpecSpecification that determines how to configure the texture
idTexture's identificator

Definition at line 201 of file Texture.c.

# decreaseUsageCount()

bool Texture::decreaseUsageCount ( )

Decrease the usage count.

Definition at line 336 of file Texture.c.

# get()

static Texture Texture::get ( ClassPointer textureClass,
const TextureSpec * textureSpec,
int16 minimumSegment,
bool mustLiveAtEvenSegment,
uint32 scValue )
staticprivate

Get a texture configured with the provided spec.

Parameters
textureClassClass of texture to instantiate
textureSpecSpec used to select or initialize a texture with
minimumSegmentMinimum BGMAP segment where to allocate the texture
mustLiveAtEvenSegmentRequired BGMAP segment where to allocate the texture
scValueSC configuration value for multi segment textures
Returns
Texture initialized with the provided spec

Definition at line 45 of file Texture.c.

# getCharSet()

CharSet Texture::getCharSet ( uint32 loadIfNeeded)

Retrieve the texture's char set.

Parameters
loadIfNeededIf true and the char set is not loaded, loads it
Returns
Texture's char set

Definition at line 317 of file Texture.c.

# getCols()

uint32 Texture::getCols ( )

Retrieve the texture's horizontal size in tiles.

Returns
Horizontal size in tiles

Definition at line 408 of file Texture.c.

# getFrame()

uint16 Texture::getFrame ( )

Retrieve frame that species the block inside the map array to write to DRAM.

Returns
The frame that species the block inside the map array to write to DRAM

Definition at line 401 of file Texture.c.

# getId()

uint16 Texture::getId ( )

Retrieve the texture's identificator.

Returns
Texture's identificator

Definition at line 276 of file Texture.c.

# getNumberOfFrames()

uint32 Texture::getNumberOfFrames ( )

Retrieve the number frames specified by the texture's spec.

Returns
Number frames specified by the texture's spec

Definition at line 378 of file Texture.c.

# getPalette()

uint8 Texture::getPalette ( )

Retrieve the palette index used the graphical data.

Returns
Palette index used by the graphical data

Definition at line 371 of file Texture.c.

# getRows()

uint32 Texture::getRows ( )

Retrieve the texture's vertical size in tiles.

Returns
Vertical size in tiles

Definition at line 415 of file Texture.c.

# getSpec()

const TextureSpec * Texture::getSpec ( )

Retrieve the texture's spec.

Returns
Specification that determines how to configure the texture

Definition at line 310 of file Texture.c.

# getTotalCols()

static uint32 Texture::getTotalCols ( TextureSpec * textureSpec)
staticprivate

Retrieve the total horizontal size of the textures defined by the provided spec.

Parameters
textureSpecSpec of which to compute the horizontal size
Returns
Total horizontal size of the textures defined by the provided spec

Definition at line 103 of file Texture.c.

# getTotalRows()

static uint32 Texture::getTotalRows ( TextureSpec * textureSpec)
staticprivate

Retrieve the total vertical size of the textures defined by the provided spec.

Parameters
textureSpecSpec of which to compute the vertical size
Returns
Total vertical size of the textures defined by the provided spec

Definition at line 127 of file Texture.c.

# getUsageCount()

int8 Texture::getUsageCount ( )

Retrieve the usage count.

Returns
Usage count

Definition at line 355 of file Texture.c.

# increaseUsageCount()

void Texture::increaseUsageCount ( )

Increase the usage count.

Definition at line 329 of file Texture.c.

# isAnimated()

bool Texture::isAnimated ( )

Check if the texture is an animation or not.

Returns
True if the CharSet has an array of animation frames

Definition at line 446 of file Texture.c.

# isMultiframe()

bool Texture::isMultiframe ( )

Check if the texture is a multiframe texture.

Returns
True if the texture is multiframe; false otherwise

Definition at line 460 of file Texture.c.

# isShared()

bool Texture::isShared ( )

Check if the texture is a shared one.

Returns
True if the texture is shared; false otherwise

Definition at line 429 of file Texture.c.

# isSingleFrame()

bool Texture::isSingleFrame ( )

Check if the texture has only one frame.

Returns
True if the texture has only one frame; false otherwise

Definition at line 453 of file Texture.c.

# isWritten()

bool Texture::isWritten ( )

Check if the texture's data is completely writen to DRAM.

Returns
True if the texture's data is completely writing to DRAM

Definition at line 422 of file Texture.c.

# onEvent()

bool Texture::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 244 of file Texture.c.

# prepare()

void Texture::prepare ( )

Prepare the texture to write its graphical data to DRAM during the next render cycle.

Definition at line 517 of file Texture.c.

# putChar()

void Texture::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 484 of file Texture.c.

# putPixel()

void Texture::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 501 of file Texture.c.

# release()

static void Texture::release ( Texture texture)
staticprivate

Release a texture.

Parameters
textureTexture to release

Definition at line 76 of file Texture.c.

# rewrite()

void Texture::rewrite ( )
virtual

Rewrite graphical data to the allocated DRAM space.

Reimplemented in BgmapTexture.

Definition at line 595 of file Texture.c.

# setFrame()

void Texture::setFrame ( uint16 frame)

Write to DRAM the graphical data of the map that corresponds to the specified frame.

Parameters
frameThe frame that species the block inside the map array to write to DRAM

Definition at line 385 of file Texture.c.

# setPalette()

void Texture::setPalette ( uint8 palette)

Set the palette index to use by the graphical data.

Parameters
palettePalette index to use by the graphical data

Definition at line 362 of file Texture.c.

# setSpec()

void Texture::setSpec ( TextureSpec * textureSpec)

Set the texture's spec.

Parameters
textureSpecSpecification that determines how to configure the texture

Definition at line 283 of file Texture.c.

# update()

bool Texture::update ( int16 maximumTextureRowsToWrite)

Update the texture's underlying graphics.

Parameters
maximumTextureRowsToWriteNumber of texture rows to write during this call

# updateTextures()

static void Texture::updateTextures ( int16 maximumTextureRowsToWrite,
bool defer )
staticprivate

Update texture pending rewriting of data in DRAM.

Parameters
maximumTextureRowsToWriteNumber of texture rows to write during this call
deferIf true, the texture data is written overtime; otherwise all is written in a single pass

Definition at line 95 of file Texture.c.

# write()

bool Texture::write ( int16 maximumTextureRowsToWrite)
virtual

Write graphical data to the allocated DRAM space.

Parameters
maximumTextureRowsToWriteNumber of texture rows to write during this call
Returns
True if the texture was written; false if it fails

Reimplemented in BgmapTexture.

Definition at line 577 of file Texture.c.

# Member Data Documentation

# charSet

CharSet Texture::charSet
private

Char set that holds the pixel data used by the texture.

Definition at line 96 of file Texture.h.

# doUpdate

void(* Texture::doUpdate) (Texture, int16)
private

Pointer to the implementation that updates graphical data in DRAM.

Definition at line 93 of file Texture.h.

# frame

uint16 Texture::frame
private

Indicator of the block inside the map array to write to DRAM.

Definition at line 108 of file Texture.h.

# id

uint16 Texture::id
private

Identificator.

Definition at line 105 of file Texture.h.

# mapDisplacement

uint32 Texture::mapDisplacement
private

Displacement inside the map array modified according to the frame's value.

Definition at line 102 of file Texture.h.

# palette

uint8 Texture::palette
private

Palette index to use by the graphical data.

Definition at line 111 of file Texture.h.

# status

uint8 Texture::status
private

Writing status flag.

Definition at line 114 of file Texture.h.

# textureSpec

const TextureSpec* Texture::textureSpec
private

Spec used to configure the texture.

Definition at line 99 of file Texture.h.

# update

bool Texture::update
private

Flag to signal that the texture needs to update DRAM in the next render cycle.

Definition at line 120 of file Texture.h.

# usageCount

int8 Texture::usageCount
private

Number of references to this texture instance.

Definition at line 117 of file Texture.h.


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