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

TextMap Class Reference

Provides an interface for handling display of text. This defaults to background layer 2. More...

#include <Backgrounds.hpp>

Inheritance diagram for TextMap:

Inheritance graph
[legend]
Collaboration diagram for TextMap:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TextMap (TileManagerScreen screen, int tile_index, int map_index, TileManagerColors bg_colors, int bg_num=2)
 Simply reinvokes the base-class constructor.

TileErrorCode prepare (const uint16 *font_data, uint32 bytes_of_fonts, const uint16 *font_palette, uint32 bytes_of_palette, int font_width, int font_height)
 Stores the information provided by the user for use later when using load to move the data into video memory.

TileErrorCode load (void)
 Calling this routine actually loads the prepared tiles and palette into memory. Then clears the screen of any characters and sets the initial cursor location to 0,0.

void clear (void)
 Clears the screen.

int screenWidth (void) const
 Returns the width of the screen as the number of characters that can be displayed on a single line.

int screenHeight (void) const
 Returns the height of the screen as the number of rows of characters that can be displayed on the screen.

void setForegroundColor (uint16 color)
 Sets palette entry 1 to the color specified.

void setBackgroundColor (uint16 color)
 Sets palette entry 0 to the color specified.

TileErrorCode setCursorPosition (int x, int y)
 Sets the cursor x/y position as specified.

int xPos (void) const
 Returns the current x position of the cursor.

int yPos (void) const
 Returns the current y position of the cursor.

TextMapoperator<< (const char *msg)
 Print a text string onto the screen.

TextMapoperator<< (char c)
 Print a character onto the screen.

TextMapoperator<< (uint32 n)
 Print an unsigned number onto the screen.

TextMapoperator<< (int32 n)
 Print a signed number onto the screen.

void writeString (const char *text)

Public Attributes

int _font_width
 Width of font in pixels.

int _font_height
 Height of font in pixels.

int _font_tile_width
 Width of font in tiles.

int _font_tile_height
 Height of font in tiles.

int _font_tiles
 Total number of tiles associated with the font.

int _screen_width
 Width of screen in font characters.

int _screen_height
 Height of screen in font characters.

int _cur_x
 Current cursor x position.

int _cur_y
 Current cursor y position.

int _radix
 The radix of the number to output.

bool _showbase
 Should the base be displayed?

int _tab_size
 The number of spaces in a tab.


Private Types

typedef TileManagerBase inherited
 Typedef to aid in changing class heirarchies without a lot of code change.


Detailed Description

Provides an interface for handling display of text. This defaults to background layer 2.


Member Function Documentation

TileErrorCode TextMap::prepare const uint16 *  font_data,
uint32  bytes_of_fonts,
const uint16 *  font_palette,
uint32  bytes_of_palette,
int  font_width,
int  font_height
 

Stores the information provided by the user for use later when using load to move the data into video memory.

Parameters:
font_data A pointer to the graphics data for the font.
bytes_of_fonts The number of bytes associated with font_data.
font_palette A pointer to the color palette for the font.
bytes_of_palette The number of bytes associated with font_palette.
font_width Specifies the width, in pixels, of the font. A multiple of 8 is required as this maps to the number of tiles in the width of the font.
font_height Speicifes the height, in pixels, of the font. A multiple of 8 is required as this maps to the number of tiles in the height of the font.
Return values:
TM_NO_ERROR Data recorded successfully.
TM_TILE_MAP_COLLISION The amount of graphics data is larger than the space provided between the start of the tile area and the map area specified for this set of tiles.
TM_BAD_DATA One of the input parameters was 0.

TileErrorCode TextMap::load void   )  [virtual]
 

Calling this routine actually loads the prepared tiles and palette into memory. Then clears the screen of any characters and sets the initial cursor location to 0,0.

Return values:
TM_NO_ERROR Data loaded successfully.
TM_NO_DATA_PREPARED The prepare method has not been called successfully.
TM_TILE_MAP_COLLISION The amount of graphics data is larger than the space provided between the start of the tile area and the map area specified for this set of tiles.

Reimplemented from TileManagerBase.

int TextMap::screenWidth void   )  const
 

Returns the width of the screen as the number of characters that can be displayed on a single line.

Returns:
The width of the screen, in characters.

int TextMap::screenHeight void   )  const
 

Returns the height of the screen as the number of rows of characters that can be displayed on the screen.

Returns:
The height of the screen, in rows of characters.

void TextMap::setForegroundColor uint16  color  ) 
 

Sets palette entry 1 to the color specified.

Parameters:
color The color to use for the text.

void TextMap::setBackgroundColor uint16  color  ) 
 

Sets palette entry 0 to the color specified.

Parameters:
color the color to use for the background/transparent color.

TileErrorCode TextMap::setCursorPosition int  x,
int  y
 

Sets the cursor x/y position as specified.

Parameters:
x The new x position.
y The new y position.
Return values:
TM_NO_ERROR The cursor position successfully moved.
TM_BAD_DATA The x or the y position is beyond the bounds of the screen.

TextMap & TextMap::operator<< const char *  msg  ) 
 

Print a text string onto the screen.

Parameters:
msg The text message to display.

TextMap & TextMap::operator<< char  c  ) 
 

Print a character onto the screen.

Parameters:
c The character to display.

TextMap & TextMap::operator<< uint32  n  ) 
 

Print an unsigned number onto the screen.

Parameters:
n The number to display on the screen.

TextMap & TextMap::operator<< int32  n  ) 
 

Print a signed number onto the screen.

Parameters:
n The number to display on the screen.

void TextMap::writeString const char *  text  ) 
 

Actually converts the string to the right characters and displays them on the screen.

Parameters:
text The text to display on the screen.


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