Function TCOD_console_printn_rect

Function Documentation

int TCOD_console_printn_rect(TCOD_Console *console, int x, int y, int width, int height, size_t n, const char *str, const TCOD_ColorRGB *fg, const TCOD_ColorRGB *bg, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment)

Print a string of a specified length in a bounding box to a console.

New in version 1.19.

Parameters
  • console – A pointer to a TCOD_Console.

  • x – The starting X position, starting from the left-most tile as zero.

  • y – The starting Y position, starting from the upper-most tile as zero.

  • width – The maximum width of the bounding region in tiles.

  • height – The maximum height of the bounding region in tiles.

  • n – The length of the string buffer str[n] in bytes.

  • str – The text to print. This string can contain libtcod color codes.

  • fg – The foreground color. The printed text is set to this color. If NULL then the foreground will be left unchanged, inheriting the previous value of the tile.

  • bg – The background color. The background tile under the printed text is set to this color. If NULL then the background will be left unchanged.

  • flag – The background blending flag. If unsure then use TCOD_BKGND_SET.

  • alignment – The text justification. This is one of TCOD_alignment_t and is normally TCOD_LEFT.

Returns

int The height of the printed text, or a negative error code on failure.