Function TCOD_console_printn

Function Documentation

TCOD_Error TCOD_console_printn(TCOD_Console *console, int x, int y, 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 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.

  • 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

TCOD_Error Any problems such as malformed UTF-8 will return a negative error code.