< index
< 2. Console emulator
< 2.2 Drawing on the root console

=====================================
Printing a centered string
=====================================

C++ : void TCODConsole::printCenter(int x, int y, TCOD_bkgnd_flag_t flag, const char *fmt, ...)
C   : void TCOD_console_print_center(TCOD_console_t con,int x, int y, TCOD_bkgnd_flag_t flag, const char *fmt, ...)
Py  : console_print_center(con,x, y, flag, fmt)

This function draws a centered string on the console, using default foreground and background colors. If the string reaches borders of the console, it is truncated.
ParameterDescription
conIn the C version, the offscreen console handler or NULL for the root console.
x,yCoordinates of the string's middle character in the console.
0 <= x < console width
0 <= y < console height
flagThis flag defines how the cell's background color is modified. See TCOD_bkgnd_flag_t.
fmtprintf-like format string, eventually followed by parameters. You can use control codes to change the colors inside the string.
insert a comment