libtcoddocumentation

2.2.6. Screen fading functions

Use these functions to easily fade to/from a color

Changing the fading parameters

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).

static void TCODConsole::setFade(uint8 fade, const TCODColor &fadingColor)

void TCOD_console_set_fade(uint8 fade, TCOD_color_t fadingColor)

console_set_fade(fade, fadingColor)

static void TCODConsole::setFade(byte fade, TCODColor fadingColor)

tcod.console.setFade(fade, fadingColor)

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:

for (int fade=255; fade >= 0; fade --) {
    TCODConsole::setFade(fade,TCODColor::black);
    TCODConsole::flush();
}

int fade;
for
(fade=255; fade >= 0; fade --) {
    TCOD_console_setFade(fade,TCOD_black);
    TCOD_console_flush();
}

for fade in range(255,0) :
    libtcod.console_setFade(fade,libtcod.black)
    libtcod.console_flush()

for fade=255,0,-1 do
    tcod.console.setFade(fade,tcod.color.black)
    tcod.console.flush()
end


Reading the fade amount

This function returns the current fade amount, previously defined by setFade.

static uint8 TCODConsole::getFade()

uint8 TCOD_console_get_fade()

console_get_fade()

static byte TCODConsole::getFade()

tcod.console.getFade()

Reading the fading color

This function returns the current fading color, previously defined by setFade.

static TCODColor TCODConsole::getFadingColor()

TCODColor TCOD_console_get_fadingColor()

console_get_fading_color()

static TCODColor TCODConsole::getFadingColor()

tcod.console.getFadingColor()