libtcod
Loading...
Searching...
No Matches
console_printing.h File Reference

Console string printing module. More...

#include <stdarg.h>
#include <stdbool.h>
#include <wchar.h>
#include "config.h"
#include "console_types.h"
#include "error.h"

Go to the source code of this file.

Classes

struct  TCOD_PrintParamsRGB
 Information about a string to be printed. More...

Typedefs

typedef enum TCOD_colctrl_t TCOD_colctrl_t
typedef struct TCOD_PrintParamsRGB TCOD_PrintParamsRGB
 Information about a string to be printed.

Enumerations

enum  TCOD_colctrl_t {
  TCOD_COLCTRL_1 = 1 , TCOD_COLCTRL_2 , TCOD_COLCTRL_3 , TCOD_COLCTRL_4 ,
  TCOD_COLCTRL_5 , TCOD_COLCTRL_NUMBER = 5 , TCOD_COLCTRL_FORE_RGB , TCOD_COLCTRL_BACK_RGB ,
  TCOD_COLCTRL_STOP
}

Functions

void TCOD_console_print (TCOD_Console *con, int x, int y, const char *fmt,...)
 Print an EASCII string on a console, using default colors and alignment.
void TCOD_console_print_ex (TCOD_Console *con, int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt,...)
 Print an EASCII string on a console, using default colors.
int TCOD_console_print_rect (TCOD_Console *con, int x, int y, int w, int h, const char *fmt,...)
 Print an EASCII string on a console constrained to a rectangle, using default colors and alignment.
int TCOD_console_print_rect_ex (TCOD_Console *con, int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt,...)
 Print an EASCII string on a console constrained to a rectangle, using default colors.
void TCOD_console_print_frame (TCOD_console_t con, int x, int y, int w, int h, bool empty, TCOD_bkgnd_flag_t flag, const char *fmt,...)
 Print an EASCII titled, framed region on a console, using default colors and alignment.
int TCOD_console_get_height_rect (TCOD_Console *con, int x, int y, int w, int h, const char *fmt,...)
 Return the number of lines that would be printed by an EASCII string.
void TCOD_console_print_utf (TCOD_Console *con, int x, int y, const wchar_t *fmt,...)
void TCOD_console_print_ex_utf (TCOD_Console *con, int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const wchar_t *fmt,...)
int TCOD_console_print_rect_utf (TCOD_Console *con, int x, int y, int w, int h, const wchar_t *fmt,...)
int TCOD_console_print_rect_ex_utf (TCOD_Console *con, int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const wchar_t *fmt,...)
int TCOD_console_get_height_rect_utf (TCOD_Console *con, int x, int y, int w, int h, const wchar_t *fmt,...)
void TCOD_console_set_color_control (TCOD_colctrl_t con, TCOD_color_t fore, TCOD_color_t back)
 Assign a foreground and background color to a color control index.
TCOD_Error TCOD_console_printf (TCOD_Console *con, int x, int y, const char *fmt,...)
 Format and print a UTF-8 string to a console.
TCOD_Error TCOD_console_printf_ex (TCOD_Console *con, int x, int y, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt,...)
 Format and print a UTF-8 string to a console.
int TCOD_console_printf_rect (TCOD_Console *con, int x, int y, int w, int h, const char *fmt,...)
 Format and print a UTF-8 string to a console.
int TCOD_console_printf_rect_ex (TCOD_Console *con, int x, int y, int w, int h, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt,...)
 Format and print a UTF-8 string to a console.
TCOD_Error TCOD_console_printf_frame (TCOD_Console *con, int x, int y, int w, int h, int empty, TCOD_bkgnd_flag_t flag, const char *fmt,...)
 Print a framed and optionally titled region to a console, using default colors and alignment.
int TCOD_console_get_height_rect_fmt (TCOD_Console *con, int x, int y, int w, int h, const char *fmt,...)
 Return the number of lines that would be printed by this formatted string.
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.
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.
int TCOD_console_get_height_rect_n (TCOD_Console *console, int x, int y, int width, int height, size_t n, const char *str)
 Return the height of the word-wrapped text with the given parameters.
int TCOD_console_get_height_rect_wn (int width, size_t n, const char *str)
 Return the height of the word-wrapped text with the given width.
TCOD_Error TCOD_console_printn_frame (TCOD_Console *console, int x, int y, int width, int height, size_t n, const char *title, const TCOD_ColorRGB *fg, const TCOD_ColorRGB *bg, TCOD_bkgnd_flag_t flag, bool clear)
TCOD_Error TCOD_console_vprintf (TCOD_Console *console, int x, int y, const TCOD_color_t *fg, const TCOD_color_t *bg, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt, va_list args)
 Print a formatted string using a va_list.
int TCOD_console_vprintf_rect (TCOD_Console *console, int x, int y, int width, int height, const TCOD_color_t *fg, const TCOD_color_t *bg, TCOD_bkgnd_flag_t flag, TCOD_alignment_t alignment, const char *fmt, va_list args)
 Print a formatted string using a va_list within a bounding box.
int TCOD_printf_rgb (TCOD_Console *console, TCOD_PrintParamsRGB params, const char *fmt,...)
 Prints a formatted string to the console.
int TCOD_printn_rgb (TCOD_Console *console, TCOD_PrintParamsRGB params, int n, const char *str)
 Prints n-bytes of a string string to the console.
int TCOD_vprintf_rgb (TCOD_Console *console, TCOD_PrintParamsRGB params, const char *fmt, va_list args)
 Prints a formatted string using va_list.

Detailed Description

Console string printing module.

Function Documentation

◆ TCOD_console_set_color_control()

void TCOD_console_set_color_control ( TCOD_colctrl_t con,
TCOD_color_t fore,
TCOD_color_t back )

Assign a foreground and background color to a color control index.

Parameters
conIndex to change, e.g. TCOD_COLCTRL_1
foreForeground color to assign to this index.
backBackground color to assign to this index.