< index
< 2. Console emulator
< 2.2 Drawing on the root console

=====================================
Changing the fading parameters
=====================================

C++ : static void TCODConsole::setFade(uint8 fade, const TCODColor &fadingColor)
C   : void TCOD_console_set_fade(uint8 fade, TCOD_color_t fadingColor)
Py  : console_set_fade(fade, fadingColor)

This function defines the fading parameters, allowing to easily fade the game screen to/from a color. Once they are defined, the fading parameters are valid for ever. You don't have to call setFade for each rendered frame (unless you change the fading parameters).
ParameterDescription
fadeThe fading amount. 0 => the screen is filled with the fading color. 255 => no fading effect.
fadingColorThe color to use during the console flushing operation.
Example :
Fading the screen to black.

C++ : for (int fade=255; fade >= 0; fade --) {
          TCODConsole::setFade(fade,TCODColor::black);
          TCODConsole::flush();
      }
C   : int fade;
      for (fade=255; fade >= 0; fade --) {
          TCOD_console_setFade(fade,TCOD_black);
          TCOD_console_flush();
      }      
Py  : for fade in range(255,0) :
          libtcod.console_setFade(fade,libtcod.black)
          libtcod.console_flush()

insert a comment