libtcoddocumentation

2.2.4. Advanced printing functions

Filling a rectangle with the background color

Fill a rectangle inside a console. For each cell in the rectangle :
* set the cell's background color to the console default background color
* if clear is true, set the cell's ASCII code to 32 (space)

void TCODConsole::rect(int x, int y, int w, int h, bool clear, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT)

void TCOD_console_rect(TCOD_console_t con,int x, int y, int w, int h, bool clear, TCOD_bkgnd_flag_t flag)

console_rect(con,x, y, w, h, clear, flag=BKGND_DEFAULT)

ParameterDescription
conin the C and Python versions, the offscreen console handler or NULL for the root console
x,ycoordinates of 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
clearif true, all characters inside the rectangle are set to ASCII code 32 (space).
If false, only the background color is modified
flagthis flag defines how the cell's background color is modified. See TCOD_bkgnd_flag_t

Drawing an horizontal line

Draws an horizontal line in the console, using ASCII code TCOD_CHAR_HLINE (196), and the console's default background/foreground colors.

void TCODConsole::hline(int x,int y, int l, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT)

void TCOD_console_hline(TCOD_console_t con,int x,int y, int l, TCOD_bkgnd_flag_t flag)

console_hline(con,x,y,l,flag=BKGND_DEFAULT)

ParameterDescription
conin the C and Python versions, the offscreen console handler or NULL for the root console
x,yCoordinates of the line's left end in the console.
0 <= x < console width
0 <= y < console height
lThe length of the line in cells 1 <= l <= console width - x
flagthis flag defines how the cell's background color is modified. See TCOD_bkgnd_flag_t

Drawing an vertical line

Draws an vertical line in the console, using ASCII code TCOD_CHAR_VLINE (179), and the console's default background/foreground colors.

void TCODConsole::vline(int x,int y, int l, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT)

void TCOD_console_vline(TCOD_console_t con,int x,int y, int l, TCOD_bkgnd_flag_t flag)

console_vline(con,x,y,l,flag=BKGND_DEFAULT)

ParameterDescription
conin the C and Python versions, the offscreen console handler or NULL for the root console
x,yCoordinates of the line's upper end in the console.
0 <= x < console width
0 <= y < console height
lThe length of the line in cells 1 <= l <= console height - y
flagthis flag defines how the cell's background color is modified. See TCOD_bkgnd_flag_t

Drawing a window frame

This function calls the rect function using the supplied background mode flag, then draws a rectangle with the console's default foreground color. If fmt is not NULL, it is printed on the top of the rectangle, using inverted colors.

void TCODConsole::printFrame(int x,int y,int w,int h, bool clear=true, TCOD_bkgnd_flag_t flag = TCOD_BKGND_DEFAULT, const char *fmt=NULL, ...)

void TCOD_console_print_frame(TCOD_console_t con,int x,int y,int w,int h, bool clear, TCOD_bkgnd_flag_t flag, const char *fmt, ...)

console_print_frame(con,x, y, w, h, clear=True, flag=BKGND_DEFAULT, fmt=0)

ParameterDescription
conin the C and Python versions, the offscreen console handler or NULL for the root console
x,yCoordinates of the rectangle's 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
clearif true, all characters inside the rectangle are set to ASCII code 32 (space).
If false, only the background color is modified
flagthis flag defines how the cell's background color is modified. See TCOD_bkgnd_flag_t
fmtif NULL, the funtion only draws a rectangle.
Else, printf-like format string, eventually followed by parameters. You can use control codes to change the colors inside the string.