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

=====================================
Printing a right aligned string with autowrap
=====================================

C++ : int TCODConsole::printRightRect(int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, const char *fmt, ...)
C   : int TCOD_console_print_right_rect(TCOD_console_t con,int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, const char *fmt, ...)

This function draws a right aligned string in a rectangle inside the console, using default foreground and background colors. If the string reaches the left border of the rectangle, carriage returns are inserted.
If h > 0 and the bottom of the rectangle is reached, the string is truncated. If h = 0, the string is only truncated if it reaches the bottom of the console.
The function returns the height (number of console lines) of the printed string.
ParameterDescription
conIn the C version, the offscreen console handler or NULL for the root console.
x,yCoordinates of the rectangle upper-left corner in the console.
0 <= x < console width
0 <= y < console height
w,hSize of the rectangle in the console.
x <= x+w < console width
y <= y+h < 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.