libtcoddocumentation

2.1.3. Using custom characters mapping

These functions allow you to map characters in the bitmap font to ASCII codes.
They should be called after initializing the root console with initRoot.
You can dynamically change the characters mapping at any time, allowing to use several fonts in the same screen.

Mapping a single ASCII code to a character

static void TCODConsole::mapAsciiCodeToFont(int asciiCode, int fontCharX, int fontCharY)

void TCOD_console_map_ascii_code_to_font(int asciiCode, int fontCharX, int fontCharY)

console_map_ascii_code_to_font(asciiCode, fontCharX, fontCharY)

static void TCODConsole::mapAsciiCodeToFont(int asciiCode, int fontCharX, int fontCharY)

tcod.console.mapAsciiCodeToFont(asciiCode, fontCharX, fontCharY)

ParameterDescription
asciiCodeASCII code to map.
fontCharX,fontCharYCoordinate of the character in the bitmap font (in characters, not pixels).

Mapping consecutive ASCII codes to consecutive characters

static void TCODConsole::mapAsciiCodesToFont(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY)

void TCOD_console_map_ascii_codes_to_font(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY)

console_map_ascii_codes_to_font(firstAsciiCode, nbCodes, fontCharX, fontCharY)

static void TCODConsole::mapAsciiCodesToFont(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY)

tcod.console.mapAsciiCodesToFont(firstAsciiCode, nbCodes, fontCharX, fontCharY)

ParameterDescription
firstAsciiCodefirst ASCII code to map
nbCodesnumber of consecutive ASCII codes to map
fontCharX,fontCharYcoordinate of the character in the bitmap font (in characters, not pixels) corresponding to the first ASCII code

Mapping ASCII code from a string to consecutive characters

static void TCODConsole::mapStringToFont(const char *s, int fontCharX, int fontCharY)

void TCOD_console_map_string_to_font(const char *s, int fontCharX, int fontCharY)

console_map_string_to_font(s, fontCharX, fontCharY)

static void TCODConsole::mapStringToFont(string s, int fontCharX, int fontCharY)

tcod.console.mapStringToFont(s, fontCharX, fontCharY)

ParameterDescription
sstring containing the ASCII codes to map
fontCharX,fontCharYcoordinate of the character in the bitmap font (in characters, not pixels) corresponding to the first ASCII code in the string