libtonc
|
Basic operations. More...
Functions | |
void | tte_set_context (TTC *tc) |
Set the master context pointer. | |
INLINE TTC * | tte_get_context (void) |
Get the master text-system. | |
INLINE uint | tte_get_glyph_id (int ch) |
Get the glyph index of character ch. | |
INLINE int | tte_get_glyph_width (uint gid) |
Get the width of glyph id. | |
INLINE int | tte_get_glyph_height (uint gid) |
Get the height of glyph id. | |
INLINE const void * | tte_get_glyph_data (uint gid) |
Get the glyph data of glyph id. | |
void | tte_set_color (eint type, u16 clr) |
Set color attribute of type to cattr. | |
void | tte_set_colors (const u16 colors[]) |
Load important color data. | |
void | tte_set_color_attr (eint type, u16 cattr) |
Set color attribute of type to cattr. | |
void | tte_set_color_attrs (const u16 cattrs[]) |
Load important color attribute data. | |
char * | tte_cmd_default (const char *str) |
Text command handler. | |
int | tte_putc (int ch) |
Plot a single character; does wrapping too. | |
int | tte_write (const char *text) |
Render a string. | |
int | tte_write_ex (int x, int y, const char *text, const u16 *clrlut) |
Extended string writer, with positional and color info. | |
void | tte_erase_rect (int left, int top, int right, int bottom) |
Erase a porttion of the screen (ignores margins) | |
void | tte_erase_screen (void) |
Erase the screen (within the margins). | |
void | tte_erase_line (void) |
Erase the whole line (within the margins). | |
POINT16 | tte_get_text_size (const char *str) |
Get the size taken up by a string. | |
void | tte_init_base (const TFont *font, fnDrawg drawProc, fnErase eraseProc) |
Base initializer of a TTC. | |
Basic operations.
This covers most of the things you can actually use TTE for, like writing the text, getting information about a glyph and setting color attributes.
char * tte_cmd_default | ( | const char * | str | ) |
Text command handler.
Takes commands formatted as "#{[cmd]:[opt];[[cmd]:[opt];...]} and deals with them.<br> <br>Command list: - <b>P</b> Set cursor to margin top-left. - <b>Ps</b> Save cursor position - <b>Pr</b> Restore cursor position. - <b>P:\#x,\#y</b> Set cursorX/Y to \e x, \e y. - <b>X</b> Set cursorX to margin left. - <b>X:\#x</b> Set cursorX to \e x. - <b>Y</b> Set cursorY to margin top. - <b>Y:\#y</b> Set cursorX to \e y. - <b>c[ispx]:\#val</b> Set ink/shadow/paper/special color to \e val. - <b>e[slbfr]</b> Erase screen/line/backward/forward/rect - <b>m:\#l,\#t,\#r,\#b</b> Set all margins - <b>m[ltrb]:\#val</b> Set margin to \e val. - <b>p:\#x,\#y</b> Move cursorX/Y by \e x, \e y. - <b>w:\#val</b> Wait \e val frame. - <b>x:\#x</b> Move cursorX by \e x. - <b>y:\#y</b> Move cursorX by \e y. Examples:<br> - <b>#{X:32}</b> Move to \e x = 32; - <b>#{ci:0x7FFF}</b> Set ink color to white. - <b>#{w:120;es;P}</b> Wait 120 frames, clear screen, return to top of screen. @param str Start of command. Assumes the initial "\{" is lobbed off already.
Scrolling and variables ?
Restructure for safety checks.
References TTC::cattr, TFont::charH, TTC::cursorX, TTC::cursorY, TTC::font, TTC::fontTable, TTC::stringTable, tte_cmd_next(), tte_erase_line(), tte_erase_rect(), tte_erase_screen(), tte_get_context(), tte_write(), and VBlankIntrDelay().
Referenced by tte_con_write(), and tte_write().
void tte_erase_line | ( | void | ) |
Erase the whole line (within the margins).
References TFont::charH, TTC::cursorY, TTC::eraseProc, TTC::font, and tte_get_context().
Referenced by tte_cmd_default(), and tte_cmd_vt100().
void tte_erase_screen | ( | void | ) |
Erase the screen (within the margins).
References TTC::eraseProc, and tte_get_context().
Referenced by tte_cmd_default(), and tte_cmd_vt100().
POINT16 tte_get_text_size | ( | const char * | str | ) |
Get the size taken up by a string.
str | String to check. |
References TFont::charH, TTC::font, TTC::lineSpacing, tte_cmd_skip(), tte_get_context(), tte_get_glyph_id(), tte_get_glyph_width(), and utf8_decode_char().
int tte_putc | ( | int | ch | ) |
Plot a single character; does wrapping too.
ch | Character to plot (not glyph-id). |
References TFont::charH, TTC::cursorX, TTC::cursorY, TTC::drawgProc, TTC::font, TTC::lineSpacing, tte_get_context(), tte_get_glyph_id(), and tte_get_glyph_width().
int tte_write | ( | const char * | text | ) |
Render a string.
text | String to parse and write. |
References TFont::charH, TTC::charLut, TFont::charOffset, TFont::charW, TTC::cursorX, TTC::cursorY, TTC::drawgProc, TTC::font, TTC::lineSpacing, tte_cmd_default(), tte_get_context(), utf8_decode_char(), and TFont::widths.
Referenced by tte_cmd_default(), and tte_write_ex().