Function TCOD_console_init_root

Function Documentation

TCOD_Error TCOD_console_init_root(int w, int h, const char *title, bool fullscreen, TCOD_renderer_t renderer)

Initialize the libtcod graphical engine.

You may want to call TCOD_console_set_custom_font BEFORE calling this function. By default this function loads libtcod’s terminal.png image from the working directory.

Afterwards TCOD_quit must be called before the program exits.

Returns 0 on success, or -1 on an error, you can check the error with TCOD_sys_get_error()

renderer and vsync settings can be overridden by the TCOD_RENDERER or TCOD_VSYNC environment variables.

Valid case-sensitive options for TCOD_RENDERER are:

  • sdl

  • opengl

  • glsl

  • sdl2

  • opengl2

Valid options for TCOD_VSYNC are 0 or 1.

Changed in version 1.12: Now returns -1 on error instead of crashing.

Changed in version 1.13: Added the TCOD_RENDERER and TCOD_VSYNC overrides.

Parameters
  • w – The width in tiles.

  • h – The height in tiles.

  • title – The title for the window.

  • fullscreen – Fullscreen option.

  • renderer – Which renderer to use when rendering the console.