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)
void TCODConsole::rect(int x, int y, int w, int h, bool clear)
void TCODConsole::rect(int x, int y, int w, int h, bool clear, TCODBackgroundFlag flag)
Console:rect(x, y, w, h, clear)
Console:rect(x, y, w, h, clear, flag)
Parameter | Description |
---|---|
con | in the C and Python versions, the offscreen console handler or NULL for the root console |
x,y | coordinates of rectangle upper-left corner in the console. 0 <= x < console width 0 <= y < console height |
w,h | size of the rectangle in the console. x <= x+w < console width y <= y+h < console height |
clear | if true, all characters inside the rectangle are set to ASCII code 32 (space). If false, only the background color is modified |
flag | this 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)
void TCODConsole::hline(int x,int y, int l)
void TCODConsole::hline(int x,int y, int l, TCODBackgroundFlag flag)
Console:hline(x,y, l)
Console:hline(x,y, l, flag)
Parameter | Description |
---|---|
con | in the C and Python versions, the offscreen console handler or NULL for the root console |
x,y | Coordinates of the line's left end in the console. 0 <= x < console width 0 <= y < console height |
l | The length of the line in cells 1 <= l <= console width - x |
flag | this 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)
void TCODConsole::vline(int x,int y, int l)
void TCODConsole::vline(int x,int y, int l, TCODBackgroundFlag flag)
Console:vline(x,y, l)
Console:vline(x,y, l, flag)
Parameter | Description |
---|---|
con | in the C and Python versions, the offscreen console handler or NULL for the root console |
x,y | Coordinates of the line's upper end in the console. 0 <= x < console width 0 <= y < console height |
l | The length of the line in cells 1 <= l <= console height - y |
flag | this 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)
void TCODConsole::printFrame(int x,int y, int w,int h)
void TCODConsole::printFrame(int x,int y, int w,int h, bool clear)
void TCODConsole::printFrame(int x,int y, int w,int h, bool clear, TCODBackgroundFlag flag)
void TCODConsole::printFrame(int x,int y, int w,int h, bool clear, TCODBackgroundFlag flag, string fmt)
Console:printFrame(x,y, w,h)
Console:printFrame(x,y, w,h, clear)
Console:printFrame(x,y, w,h, clear, flag)
Console:printFrame(x,y, w,h, clear, flag, fmt)
Parameter | Description |
---|---|
con | in the C and Python versions, the offscreen console handler or NULL for the root console |
x,y | Coordinates of the rectangle's upper-left corner in the console. 0 <= x < console width 0 <= y < console height |
w,h | size of the rectangle in the console. x <= x+w < console width y <= y+h < console height |
clear | if true, all characters inside the rectangle are set to ASCII code 32 (space). If false, only the background color is modified |
flag | this flag defines how the cell's background color is modified. See TCOD_bkgnd_flag_t |
fmt | if 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. |