2.1.1. Creating the game window
static void TCODConsole::initRoot (int w, int h, const char * title, bool fullscreen = false, TCOD_renderer_t renderer = TCOD_RENDERER_GLSL)
void TCOD_console_init_root (int w, int h, const char * title, bool fullscreen, TCOD_renderer_t renderer)
console_init_root (w, h, title, fullscreen = False, renderer = RENDERER_GLSL)
static void TCODConsole::initRoot(int w, int h, string title)
static void TCODConsole::initRoot(int w, int h, string title, bool fullscreen)
static void TCODConsole::initRoot(int w, int h, string title, bool fullscreen, TCODRendererType renderer)
tcod.console.initRoot(w,h,title) -- fullscreen = false, renderer = GLSL
tcod.console.initRoot(w,h,title,fullscreen) -- renderer = GLSL
tcod.console.initRoot(w,h,title,fullscreen,renderer)
Parameter | Description |
---|---|
w,h | size of the console(in characters). The default font in libtcod (./terminal.png) uses 8x8 pixels characters. You can change the font by calling TCODConsole::setCustomFont before calling initRoot. |
title | title of the window. It's not visible when you are in fullscreen. Note 1 : you can dynamically change the window title with TCODConsole::setWindowTitle |
fullscreen | wether you start in windowed or fullscreen mode. Note 1 : you can dynamically change this mode with TCODConsole::setFullscreen Note 2 : you can get current mode with TCODConsole::isFullscreen |
renderer | which renderer to use. Possible values are : * TCOD_RENDERER_GLSL : works only on video cards with pixel shaders * TCOD_RENDERER_OPENGL : works on all video cards supporting OpenGL 1.4 * TCOD_RENDERER_SDL : should work everywhere! Note 1: if you select a renderer that is not supported by the player's machine, libtcod scan the lower renderers until it finds a working one. Note 2: on recent video cards, GLSL results in up to 900% increase of framerates in the true color sample compared to SDL renderer. Note 3: whatever renderer you use, it can always be overriden by the player through the libtcod.cfg file. Note 4: you can dynamically change the renderer after calling initRoot with TCODSystem::setRenderer. Note 5: you can get current renderer with TCODSystem::getRenderer. It might be different from the one you set in initRoot in case it's not supported on the player's computer. |
Example:
TCODConsole::initRoot(80, 50, "The Chronicles Of Doryen v0.1");
TCOD_console_init_root(80, 50, "The Chronicles Of Doryen v0.1", false, TCOD_RENDERER_SDL);
libtcod.console_init_root(80, 50, 'The Chronicles Of Doryen v0.1')
tcod.console.initRoot(80,50,"The Chronicles Of Doryen v0.1")