HAM Documentation

Home · Downloads · Your Account · Submit News

Documentation Homepage HAMLib reference Back to HAM Homepage |

# Text Output Functions (Screen/Debug/Serial)

## Functions

void | ham_VBAText (char *fmt,...)
| Output formatted string on VBA debug console
void | ham_DrawText (u8 x, u8 y, char *fmt,...)
| Output formatted string on a tiles mode GBA screen
void | ham_InitText (u8 bgno)
| Initialize the HAM DrawText system
void | ham_SetTextCol (u8 front_col, u8 back_col)
| Set the foreground and background color numbers for the DrawText system
void | ham_DeInitText (void)
| De-Initialize the DrawText system

## Function Documentation

void ham_DeInitText | ( | void |  | ) |

| De-Initialize the DrawText system This will completely remove the ham_DrawText system and all resources reserved for it. See also: ham_InitText()

void ham_DrawText | ( | u8 | x,
|  | u8 | y,
|  | char * | fmt,
|  | ... |
| ) |

Output formatted string on a tiles mode GBA screen

Parameters:

  x | The X character number the string should start on
  y | The Y character number the string should start on
  fmt | The Format string (see printf() documentation in your local C tutorial)

This function will output a text string to the GBA display. Before using this, you need to call ham_InitText() . You can also print the value of variables this way, by putting a format string and additional parameters. For example:

ham_DrawText(1,1,"My Name is %s I am %d years old",string_ptr,int yrs_old);

ATTENTION: This function is powerful, but VERY slow and should not be used in production code. It should only be used for debugging purposes.

See also: ham_VBAText()

void ham_InitText | ( | u8 | bgno | ) |

Initialize the HAM DrawText system

Parameters:

  bgno | The BG number you want your text system to show Text on.

Before you can use ham_DrawText() , HAM will need to reserve a BG and load the font characters into VRAM. This function does that. Note it will only work in tiled display modes.

See also: ham_DrawText() ham_SetBgMode()

void ham_SetTextCol | ( | u8 | front_col,
|  | u8 | back_col
| ) |

Set the foreground and background color numbers for the DrawText system

Parameters:

  front_col | The BG color palette entry number of the color that should be used for rendering the text itself
  back_col | The BG color palette entry number of the color that should be used for rendering the 8*8 pixel area around the text

See also: ham_LoadBgPal() ham_LoadBgPal16() ham_DrawText()

void ham_VBAText | ( | char * | fmt,
|  | ... |
| ) |

Output formatted string on VBA debug console

Parameters:

  fmt | The Format string (see printf() documentation in your local C tutorial)

This function will output a text string to the debug console of VisualBoyAdvance. You can also print the value of variables this way, by putting a format string and additional parameters. For example:

ham_VBAText("My Name is %s I am %d years old",string_ptr,int yrs_old);

ATTENTION: This function is powerful, but pretty slow and should not be used in production code.

See also: ham_DrawText()

Documentation Homepage | HAMLib reference | Back to HAM Homepage
documentation created with Doxygen