Text output system


Defines

#define PA_SetTileLetter(screen, x, y, letter)   PA_SetMapTileAll(screen, PAbgtext[screen], x, y, (PA_textmap[screen][(u16)letter]&((1<<12)-1)) + (PAtext_pal[screen] << 12))
 Output a letter on the DS screen.
#define PA_InitCustomText(screen, bg_select, text)   PA_InitCustomTextEx(screen, bg_select, text##_Tiles, text##_Map, text##_Pal)
 Init the text using one of your own fonts !
#define PA_ShowFont(screen)   PA_LoadBgMap(screen, PAbgtext[screen], (void*)PA_textmap[screen], BG_256X256)
 Show the current font used. This is just for debug, no real use ingame.
#define PA_8bitCustomFont(bit8_slot, bit8_font)
 Add custom fonts to the 8bit Font system !! Font must be converted with PAGfx.

Functions

void PA_InitText (u8 screen, u8 bg_select)
 Output text on the gba screen. Works only in modes 0-2.
void PA_SetTextTileCol (u8 screen, u8 color)
 Change the text writing color (does not change the current text's color).
void PA_OutputText (u8 screen, u16 x, u16 y, char *text,...)
 Output text on the DS screen. Works only in modes 0-2.
u16 PA_OutputSimpleText (u8 screen, u16 x, u16 y, const char *text)
 Output simple text on the DS screen. Works only in modes 0-2. Much faster than PA_OutputText, but much more limited... Returns the number of letters.
u32 PA_BoxText (u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit)
 Output text on the DS screen. This text is limited to a chosen box, and you can chose the number of letters to output (can be used to show 'typed' text, just put 10000 if you want to show all the text...). Returns the number of letters outputed.
u32 PA_BoxTextNoWrap (u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit)
 Output text on the DS screen. This text is limited to a chosen box, and you can chose the number of letters to output (can be used to show 'typed' text, just put 10000 if you want to show all the text...). Returns the number of letters outputed. This function does not support word wrapping.
void PA_SetTextCol (u8 screen, u16 r, u16 g, u16 b)
 Change the screen text's default color.
s16 PA_8bitText (u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char *text, u8 color, u8 size, u8 transp, s32 limit)
 This is a variable width and variable size function to draw text on the screen. It draws on an 8 bit background (see PA_Init8bitBg for more info), and has options such as size, transaprency, and box limits, as well as the color. Only problem : it does not take commands such as d, etc... The function returns the number of characters it outputed.
s16 PA_16bitText (u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char *text, u16 color, u8 size, u8 transp, s32 limit)
s16 PA_CenterSmartText (u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char *text, u8 color, u8 size, u8 transp)
 Basicaly the same as the SmartText function, but this time centered...
void PA_CopyText (char *text1, char *text2)
 Copy one string into another.
void PA_InitTextBorders (u8 screen, u8 x1, u8 y1, u8 x2, u8 y2)
 Initialise a text box with it's borders. This makes writing in a delimited area much easier...
void PA_EraseTextBox (u8 screen)
 Erases the text in a textbox. Requires that that box be initialized with PA_InitTextBorders.
u32 PA_SimpleBoxText (u8 screen, const char *text, u32 limit)
 Write text in an initiliazed textbox. Similar to PA_BoxText, but without needing the text limits.
void PA_ClearTextBg (u8 screen)
 Erase all the text on a given screen.
void PA_Print (u8 screen, char *text,...)
 Output text on the DS screen. Works like a printf function.
void PA_PrintLetter (u8 screen, char letter)
 Like PA_Print, but for a letter.
void PA_OutputTextSpecial0 (u8 screen, int x1, int y, char *text)
void PA_OutputTextSpecial1 (u8 screen, int x1, int y, char *text)
void PA_OutputTextSpecial2 (u8 screen, int x1, int y, char *text)
void PA_OutputTextSpecial3 (u8 screen, int x1, int y, char *text)
void PA_OutputTextSpecial4 (u8 screen, int x1, int y, char *text)
void PA_OutputTextSpecial5 (u8 screen, int x1, int y, char *text)

Detailed Description

Allows you to output text...

Define Documentation

#define PA_8bitCustomFont ( bit8_slot,
bit8_font   ) 

Value:

{\
        bittext_maps[bit8_slot] = (u16*)(void*)bit8_font##_Map;         \
        bit8_tiles[bit8_slot] = (u8*)bit8_font##_Tiles; \
        pa_bittextdefaultsize[bit8_slot] = (u8*)bit8_font##_Sizes;      \
        pa_bittextpoliceheight[bit8_slot] = bit8_font##_Height;\
}
Add custom fonts to the 8bit Font system !! Font must be converted with PAGfx.

Parameters:
bit8_slot Font slot... 0-4 are used by the defaut PAlib fonts, 5-9 are free to use. You can freely overwrite the PAlib fonts if you want
bit8_font Font name;..

#define PA_InitCustomText ( screen,
bg_select,
text   )     PA_InitCustomTextEx(screen, bg_select, text##_Tiles, text##_Map, text##_Pal)

Init the text using one of your own fonts !

Parameters:
screen Chose de screen (0 or 1)
bg_select Background number...
text Font image file name converted with PAGfx

#define PA_SetTileLetter ( screen,
x,
y,
letter   )     PA_SetMapTileAll(screen, PAbgtext[screen], x, y, (PA_textmap[screen][(u16)letter]&((1<<12)-1)) + (PAtext_pal[screen] << 12))

Output a letter on the DS screen.

Parameters:
screen Chose de screen (0 or 1)
x X coordinate in TILES (0-31) where to write the letter
y Y coordinate in TILES (0-19) where to write the letter
letter Letter... 'a', 'Z', etc...

#define PA_ShowFont ( screen   )     PA_LoadBgMap(screen, PAbgtext[screen], (void*)PA_textmap[screen], BG_256X256)

Show the current font used. This is just for debug, no real use ingame.

Parameters:
screen Chose de screen (0 or 1)


Function Documentation

s16 PA_16bitText ( u8  screen,
s16  basex,
s16  basey,
s16  maxx,
s16  maxy,
char *  text,
u16  color,
u8  size,
u8  transp,
s32  limit 
)

s16 PA_8bitText ( u8  screen,
s16  basex,
s16  basey,
s16  maxx,
s16  maxy,
char *  text,
u8  color,
u8  size,
u8  transp,
s32  limit 
)

This is a variable width and variable size function to draw text on the screen. It draws on an 8 bit background (see PA_Init8bitBg for more info), and has options such as size, transaprency, and box limits, as well as the color. Only problem : it does not take commands such as d, etc... The function returns the number of characters it outputed.

Parameters:
screen Chose de screen (0 or 1)
basex X coordinate of the top left corner
basey Y coordinate of the top left corner
maxx X coordinate of the down right corner
maxy Y coordinate of the down right corner
text Text, such as "Hello World"
color Palette color to use (0-255)
size Size of the text, from 0 (really small) to 4 (pretty big)
transp Transparency. Setting this to 0 will overwrite all drawing in the text zone. 1 will write the text without erasing the drawing. 2 won't output anything (just to count the letters), 3 is rotated one way, 4 rotated the other way
limit You can give a maximum number of characters to output. This can be usefull to have a slowing drawing text (allow to draw 1 more character each frame...)

u32 PA_BoxText ( u8  screen,
u16  basex,
u16  basey,
u16  maxx,
u16  maxy,
const char *  text,
u32  limit 
)

Output text on the DS screen. This text is limited to a chosen box, and you can chose the number of letters to output (can be used to show 'typed' text, just put 10000 if you want to show all the text...). Returns the number of letters outputed.

Parameters:
screen Chose de screen (0 or 1)
basex X coordinate in TILES (0-31) where to begin writing the text
basey Y coordinate in TILES (0-19) where to begin writing the text
maxx X coordinate in TILES (0-31) where to stop writing the text
maxy Y coordinate in TILES (0-19) where to stop writing the text
text String to output.
limit Maximum number of letters to show this time

u32 PA_BoxTextNoWrap ( u8  screen,
u16  basex,
u16  basey,
u16  maxx,
u16  maxy,
const char *  text,
u32  limit 
)

Output text on the DS screen. This text is limited to a chosen box, and you can chose the number of letters to output (can be used to show 'typed' text, just put 10000 if you want to show all the text...). Returns the number of letters outputed. This function does not support word wrapping.

Parameters:
screen Chose de screen (0 or 1)
basex X coordinate in TILES (0-31) where to begin writing the text
basey Y coordinate in TILES (0-19) where to begin writing the text
maxx X coordinate in TILES (0-31) where to stop writing the text
maxy Y coordinate in TILES (0-19) where to stop writing the text
text String to output.
limit Maximum number of letters to show this time

s16 PA_CenterSmartText ( u8  screen,
s16  basex,
s16  basey,
s16  maxx,
s16  maxy,
char *  text,
u8  color,
u8  size,
u8  transp 
)

Basicaly the same as the SmartText function, but this time centered...

Parameters:
screen Chose de screen (0 or 1)
basex X coordinate of the top left corner
basey Y coordinate of the top left corner
maxx X coordinate of the down right corner
maxy Y coordinate of the down right corner
text Text, such as "Hello World"
color Palette color to use (0-255)
size Size of the text, from 0 (really small) to 4 (pretty big)
transp Transparency. Setting this to 0 will overwrite all drawing in the text zone. 1 will write the text without erasing the drawing. 2 won't output anything (just to count the letters), 3 is rotated one way, 4 rotated the other way

void PA_ClearTextBg ( u8  screen  ) 

Erase all the text on a given screen.

Parameters:
screen Chose de screen (0 or 1)

inline void PA_CopyText ( char *  text1,
char *  text2 
) [inline]

Copy one string into another.

Parameters:
text1 String to change
text2 String to copy into the other

void PA_EraseTextBox ( u8  screen  ) 

Erases the text in a textbox. Requires that that box be initialized with PA_InitTextBorders.

Parameters:
screen Chose de screen (0 or 1)

void PA_InitText ( u8  screen,
u8  bg_select 
)

Output text on the gba screen. Works only in modes 0-2.

Parameters:
screen Chose de screen (0 or 1)
bg_select Background number (0-3)

void PA_InitTextBorders ( u8  screen,
u8  x1,
u8  y1,
u8  x2,
u8  y2 
)

Initialise a text box with it's borders. This makes writing in a delimited area much easier...

Parameters:
screen Chose de screen (0 or 1)
x1 Left limit in tiles
y1 Top
x2 Right
y2 Bottom

u16 PA_OutputSimpleText ( u8  screen,
u16  x,
u16  y,
const char *  text 
)

Output simple text on the DS screen. Works only in modes 0-2. Much faster than PA_OutputText, but much more limited... Returns the number of letters.

Parameters:
screen Chose de screen (0 or 1)
x X coordinate in TILES (0-31) where to begin writing the text
y Y coordinate in TILES (0-19) where to begin writing the text
text String to output.

void PA_OutputText ( u8  screen,
u16  x,
u16  y,
char *  text,
  ... 
)

Output text on the DS screen. Works only in modes 0-2.

Parameters:
screen Chose de screen (0 or 1)
x X coordinate in TILES (0-31) where to begin writing the text
y Y coordinate in TILES (0-19) where to begin writing the text
text String to output. The following commands are avaiblable : %s to output another string, %d to output a value, %fX to output a float with X digits, \n to go to the line. Here's an example : PA_OutputText(0, 0, 1, "My name is %s and I have only %d teeth", "Mollusk", 20);

void PA_OutputTextSpecial0 ( u8  screen,
int  x1,
int  y,
char *  text 
)

void PA_OutputTextSpecial1 ( u8  screen,
int  x1,
int  y,
char *  text 
)

void PA_OutputTextSpecial2 ( u8  screen,
int  x1,
int  y,
char *  text 
)

void PA_OutputTextSpecial3 ( u8  screen,
int  x1,
int  y,
char *  text 
)

void PA_OutputTextSpecial4 ( u8  screen,
int  x1,
int  y,
char *  text 
)

void PA_OutputTextSpecial5 ( u8  screen,
int  x1,
int  y,
char *  text 
)

void PA_Print ( u8  screen,
char *  text,
  ... 
)

Output text on the DS screen. Works like a printf function.

Parameters:
screen Chose de screen (0 or 1)
text String to output. The following commands are avaiblable : %s to output another string, %d to output a value, %fX to output a float with X digits, \n to go to the line. Here's an example : PA_OutputText(0, 0, 1, "My name is %s and I have only %d teeth", "Mollusk", 20);

inline void PA_PrintLetter ( u8  screen,
char  letter 
) [inline]

Like PA_Print, but for a letter.

Parameters:
screen Chose de screen (0 or 1)
letter Any letter...

inline void PA_SetTextCol ( u8  screen,
u16  r,
u16  g,
u16  b 
) [inline]

Change the screen text's default color.

Parameters:
screen Chose de screen (0 or 1)
r Red amount (0-31)
g Green amount (0-31)
b Blue amount (0-31)

inline void PA_SetTextTileCol ( u8  screen,
u8  color 
) [inline]

Change the text writing color (does not change the current text's color).

Parameters:
screen Chose de screen (0 or 1)
color Color, from 0 to 6, just test to see the result...

inline u32 PA_SimpleBoxText ( u8  screen,
const char *  text,
u32  limit 
) [inline]

Write text in an initiliazed textbox. Similar to PA_BoxText, but without needing the text limits.

Parameters:
screen Chose de screen (0 or 1)
text String to output.
limit Maximum number of letters to show this time


Generated on Sat Jun 13 12:55:14 2009 for PAlib - Programmer's Arsenal by  doxygen 1.5.8