Printer Class Reference

#include <Printer.h>

Inheritance diagram for Printer:
Entity

# Public Types

enum  PrintingOrientation
enum  PrintingDirection
typedef const FontSpec FontROMSpec
typedef const FontData FontROMData

# Public Member Functions

override bool onEvent (ListenerObject eventFirer, uint16 eventCode)
override void removedComponent (Component component)
void reset ()
 Empties internal virtual list of registered fonts.

# Static Public Member Functions

static void setDebugMode ()
 Set mode to debug to bypass loading fonts through CharSets.
static void loadFonts (FontSpec **fontSpecs)
static void releaseFonts ()
 Release fonts, free VRAM.
static void clear ()
 Clear printing area in BGMAP memory.
static void clearRow (uint16 row)
static void text (const char *string, int32 x, int32 y, const char *font)
static void int32 (int32 value, uint8 x, uint8 y, const char *font)
static void hex (WORD value, uint8 x, uint8 y, uint8 length, const char *font)
static void float (float value, uint8 x, uint8 y, int32 precision, const char *font)
static void setFontPage (const char *font, uint16 page)
static void setOrientation (uint8 value)
static void setTextDirection (uint8 value)
static void addSprite ()
 Create a printing sprite.
static bool setActiveSprite (uint16 printingSpriteIndex)
static void printSprite (int16 x, int16 y)
static void setCoordinates (int16 x, int16 y, int16 z, int8 parallax)
static void setWorldCoordinates (int16 x, int16 y, int16 z, int8 parallax)
static void setBgmapCoordinates (int16 mx, int16 my, int8 mp)
static void setWorldSize (uint16 w, uint16 h)
static void setTransparency (uint8 transparency)
static void setPalette (uint8 palette)
static void resetCoordinates ()
 Reset the coordinates of the WORLD used for printing.
static int16 getWorldCoordinatesX ()
static int16 getWorldCoordinatesY ()
static int16 getWorldCoordinatesP ()
static PixelVector getActiveSpritePosition ()
static FontDatagetFontByName (const char *font)
static FontSize getTextSize (const char *string, const char *font)

# Protected Attributes

PrintingSprite activePrintingSprite
 Active sprite that is manipulated by this class' interface.
const char * lastUsedFont
 Cache the last used font to speed up searches.
FontDatalastUsedFontData
 Cache the last used font data to speed up searches.
uint8 mode
 Printer mode (Default or Debug)
uint8 palette
 Palette to use for printing.
uint8 orientation
 Printer orientation.
uint8 direction
 Printer direction.
int8 printingBgmapSegment
 Printer segment (BGMAP memory)

# Additional Inherited Members

- Private Member Functions inherited from Entity
void constructor ()
 Class' constructor.
override bool handleMessage (Telegram telegram)
void clearComponentLists (uint32 componentType)
Component addComponent (const ComponentSpec *componentSpec)
void removeComponent (Component component)
void addComponents (ComponentSpec **componentSpecs, uint32 componentType)
void removeComponents (uint32 componentType)
Component getComponentAtIndex (uint32 componentType, int16 componentIndex)
VirtualList getComponents (uint32 componentType)
bool getComponentsOfClass (ClassPointer classPointer, VirtualList components, uint32 componentType)
uint16 getComponentsCount (uint32 componentType)
void resetComponents ()
 Reset components.
void setVisible ()
 Set this instance's visibility flag up.
const TransformationgetTransformation ()
const Vector3DgetPosition ()
const RotationgetRotation ()
const ScalegetScale ()
Body getBody ()
bool isMoving ()
void stopAllMovement ()
 Stop all entity's movement.
void stopMovement (uint16 axis)
bool setVelocity (const Vector3D *velocity, bool checkIfCanMove)
const Vector3DgetVelocity ()
fixed_t getSpeed ()
fixed_t getMaximumSpeed ()
fixed_t getBounciness ()
fixed_t getFrictionCoefficient ()
void enableCollisions ()
 Enable collision detection on the entity's colliders.
void disableCollisions ()
 Disable collision detection on the entity's colliders.
void checkCollisions (bool activate)
void registerCollisions (bool activate)
void setCollidersLayers (uint32 layers)
uint32 getCollidersLayers ()
void setCollidersLayersToIgnore (uint32 layersToIgnore)
uint32 getCollidersLayersToIgnore ()
bool hasColliders ()
void showColliders ()
 Make the entity's colliders visible.
void hideColliders ()
 Make the entity's colliders invisible.
virtual void createComponents (ComponentSpec **componentSpecs)
virtual void destroyComponents ()
 Destroy the components that attach to this container.
virtual void addedComponent (Component component)
virtual void show ()
 Make this instance visible.
virtual void hide ()
 Make this instance invisible.
virtual void calculateSize ()
 Configure the entity's size.
virtual fixed_t getRadius ()
virtual void setPosition (const Vector3D *position)
virtual void setRotation (const Rotation *rotation)
virtual void setScale (const Scale *scale)
virtual void setDirection (const Vector3D *direction)
virtual const Vector3DgetDirection ()
virtual bool applyForce (const Vector3D *force, bool checkIfCanMove)
virtual bool canMoveTowards (Vector3D direction)
virtual bool isSensibleToCollidingObjectBouncinessOnCollision (Entity collidingEntity)
virtual bool isSensibleToCollidingObjectFrictionOnCollision (Entity collidingEntity)
virtual bool isSubjectToGravity (Vector3D gravity)
virtual bool collisionStarts (const CollisionInformation *collisionInformation)
virtual void collisionPersists (const CollisionInformation *collisionInformation)
virtual void collisionEnds (const CollisionInformation *collisionInformation)
virtual uint32 getInGameType ()
- Private Attributes inherited from Entity
VirtualListcomponents
 Linked list of attached components.
Transformation transformation
 3D transformation
Body body
bool isVisible
 Flag used for streaming purposes.

# Detailed Description

Class Printer

Inherits from ListenerObject

Manages printing layer and offers various functions to write to it.

Definition at line 171 of file Printer.h.

# Member Typedef Documentation

# FontROMData

typedef const FontData FontROMData

A FontData spec that is stored in ROM

Definition at line 160 of file Printer.h.

# FontROMSpec

typedef const FontSpec FontROMSpec

Definition at line 145 of file Printer.h.

# Member Enumeration Documentation

# PrintingDirection

Definition at line 107 of file Printer.h.

# PrintingOrientation

Definition at line 100 of file Printer.h.

# Member Function Documentation

# addSprite()

static void Printer::addSprite ( )
static

Create a printing sprite.

Definition at line 418 of file Printer.c.

# clear()

static void Printer::clear ( )
static

Clear printing area in BGMAP memory.

Definition at line 206 of file Printer.c.

# clearRow()

static void Printer::clearRow ( uint16 row)
static

Clear a given row in the printable area of BGMAP memory.

Parameters
rowRow to clean (0-27)

Definition at line 222 of file Printer.c.

# float()

static void Printer::float ( float value,
uint8 x,
uint8 y,
int32 precision,
const char * font )
static

Print a float value.

Parameters
valueFloat value to print
xColumn to start printing at
yRow to start printing at
precisionHow many decimals to print
fontName of font to use for printing

Definition at line 255 of file Printer.c.

# getActiveSpritePosition()

static PixelVector Printer::getActiveSpritePosition ( )
static

Retrieve the active sprite's position.

Returns
Sprite's position

Definition at line 643 of file Printer.c.

# getFontByName()

static FontData * Printer::getFontByName ( const char * font)
static

Get font spec and starting position in character memory.

Parameters
fontName of font to get spec for
Returns
FontData of desired font or default font if NULL or none could be found matching the name

Definition at line 656 of file Printer.c.

# getTextSize()

static FontSize Printer::getTextSize ( const char * string,
const char * font )
static

Get the size of a (block of) text so you can for example center it on screen.

Parameters
stringString to compute size for
fontName of font to use for size computation

Definition at line 707 of file Printer.c.

# getWorldCoordinatesP()

static int16 Printer::getWorldCoordinatesP ( )
static

Retrieve WORLD's gp.

Returns
: WORLD's gp

Definition at line 634 of file Printer.c.

# getWorldCoordinatesX()

static int16 Printer::getWorldCoordinatesX ( )
static

Retrieve WORLD's gx.

Returns
WORLD's gx

Definition at line 616 of file Printer.c.

# getWorldCoordinatesY()

static int16 Printer::getWorldCoordinatesY ( )
static

Retrieve WORLD's gy.

Returns
: WORLD's gy

Definition at line 625 of file Printer.c.

# hex()

static void Printer::hex ( WORD value,
uint8 x,
uint8 y,
uint8 length,
const char * font )
static

Print a hex value.

Parameters
valueHex value to print
xColumn to start printing at
yRow to start printing at
lengthDigits to print
fontName of font to use for printing

Definition at line 248 of file Printer.c.

# int32()

static void Printer::int32 ( int32 value,
uint8 x,
uint8 y,
const char * font )
static

Print an integer value.

Parameters
valueInteger to print
xColumn to start printing at
yRow to start printing at
fontName of font to use for printing

Definition at line 241 of file Printer.c.

# loadFonts()

static void Printer::loadFonts ( FontSpec ** fontSpecs)
static

Add fonts to internal VirtualList and preload CharSets for specified fonts.

Parameters
fontSpecsArray of font specs whose charset should pre preloaded

Must force CHAR defragmentation

Definition at line 130 of file Printer.c.

# onEvent()

bool Printer::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 963 of file Printer.c.

# printSprite()

static void Printer::printSprite ( int16 x,
int16 y )
static

Print active printing sprite's info.

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

Definition at line 454 of file Printer.c.

# releaseFonts()

static void Printer::releaseFonts ( )
static

Release fonts, free VRAM.

Definition at line 180 of file Printer.c.

# removedComponent()

void Printer::removedComponent ( Component component)
virtual

A component has been removed from this entity.

Parameters
componentRemoved component

Reimplemented from Entity.

Definition at line 987 of file Printer.c.

# reset()

secure void Printer::reset ( )

Empties internal virtual list of registered fonts.

Definition at line 996 of file Printer.c.

# resetCoordinates()

static void Printer::resetCoordinates ( )
static

Reset the coordinates of the WORLD used for printing.

Definition at line 604 of file Printer.c.

# setActiveSprite()

static bool Printer::setActiveSprite ( uint16 printingSpriteIndex)
static

Set the active printing sprite.

Parameters
printingSpriteIndexIndex of the sprite to activate

Definition at line 436 of file Printer.c.

# setBgmapCoordinates()

static void Printer::setBgmapCoordinates ( int16 mx,
int16 my,
int8 mp )
static

Set the coordinates of the BGMAP used for printing.

Parameters
mxBGMAP x coordinate
myBGMAP y coordinate
mpBGMAP parallax value

Definition at line 531 of file Printer.c.

# setCoordinates()

static void Printer::setCoordinates ( int16 x,
int16 y,
int16 z,
int8 parallax )
static

Set the coordinates used for printing.

Parameters
xWORLD x coordinate
yWORLD y coordinate
zWORLD parallax value
parallaxWORLD parallax value

Definition at line 474 of file Printer.c.

# setDebugMode()

static void Printer::setDebugMode ( )
static

Set mode to debug to bypass loading fonts through CharSets.

Definition at line 111 of file Printer.c.

# setFontPage()

static void Printer::setFontPage ( const char * font,
uint16 page )
static

Writes the font's char set to CHAR memory with displacing the source pointer by numberOfChars * page.

Parameters
fontName of font to use for printing
pageROM's displacement multiplier

Definition at line 360 of file Printer.c.

# setOrientation()

static void Printer::setOrientation ( uint8 value)
static

Sets the orientation for the following call to print. Resets its self automatically to horizonal.

Parameters
valuePrintingOrientation

Definition at line 374 of file Printer.c.

# setPalette()

static void Printer::setPalette ( uint8 palette)
static

Set palette for the printing area.

Parameters
palettePalette for the printing area

Definition at line 592 of file Printer.c.

# setTextDirection()

static void Printer::setTextDirection ( uint8 value)
static

Sets the direction for the following call to print. Resets its self automatically to LTR (Left to Right).

Parameters
valuePrintingDirection

Definition at line 396 of file Printer.c.

# setTransparency()

static void Printer::setTransparency ( uint8 transparency)
staticvirtual

Set sprite's transparency

Parameters
transparencyTransparent value (__TRANSPARENCY_NONE, _EVEN or _ODD)

Reimplemented from Entity.

Definition at line 580 of file Printer.c.

# setWorldCoordinates()

static void Printer::setWorldCoordinates ( int16 x,
int16 y,
int16 z,
int8 parallax )
static

Set the coordinates of the WORLD used for printing.

Parameters
xWORLD x coordinate
yWORLD y coordinate
zWORLD parallax value
parallaxWORLD parallax value

Definition at line 499 of file Printer.c.

# setWorldSize()

static void Printer::setWorldSize ( uint16 w,
uint16 h )
static

Set WORLD's size.

Parameters
wWORLD's width
hWORLD's height

Definition at line 564 of file Printer.c.

# text()

static void Printer::text ( const char * string,
int32 x,
int32 y,
const char * font )
static

Print a string.

Parameters
stringString to print
xColumn to start printing at
yRow to start printing at
fontName of font to use for printing

Definition at line 230 of file Printer.c.

# Member Data Documentation

# activePrintingSprite

PrintingSprite Printer::activePrintingSprite
protected

Active sprite that is manipulated by this class' interface.

Definition at line 176 of file Printer.h.

# direction

uint8 Printer::direction
protected

Printer direction.

Definition at line 194 of file Printer.h.

# lastUsedFont

const char* Printer::lastUsedFont
protected

Cache the last used font to speed up searches.

Definition at line 179 of file Printer.h.

# lastUsedFontData

FontData* Printer::lastUsedFontData
protected

Cache the last used font data to speed up searches.

Definition at line 182 of file Printer.h.

# mode

uint8 Printer::mode
protected

Printer mode (Default or Debug)

Definition at line 185 of file Printer.h.

# orientation

uint8 Printer::orientation
protected

Printer orientation.

Definition at line 191 of file Printer.h.

# palette

uint8 Printer::palette
protected

Palette to use for printing.

Definition at line 188 of file Printer.h.

# printingBgmapSegment

int8 Printer::printingBgmapSegment
protected

Printer segment (BGMAP memory)

Definition at line 197 of file Printer.h.


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