< index
< 2. Console emulator
< 2.1 Initializing the console

=====================================
2.1.3 Using custom characters mappings
=====================================

This function allows you to map a character in the bitmap font to an ASCII code.
It 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.

2.1.3.1 Mapping a single ASCII code to a character
2.1.3.2 Mapping consecutive ASCII codes to consecutive characters
2.1.3.3 Mapping ASCII code from a string to consecutive characters

2.1.3.1 Mapping a single ASCII code to a character

C++ : static void TCODConsole::mapAsciiCodeToFont(int asciiCode, int fontCharX, int fontCharY)
C   : void TCOD_console_map_ascii_code_to_font(int asciiCode, int fontCharX, int fontCharY)
Py  : console_map_ascii_code_to_font(asciiCode, fontCharX, fontCharY)

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

2.1.3.2 Mapping consecutive ASCII codes to consecutive characters

C++ : static void TCODConsole::mapAsciiCodesToFont(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY)
C   : void TCOD_console_map_ascii_codes_to_font(int firstAsciiCode, int nbCodes, int fontCharX, int fontCharY)
Py  : console_map_ascii_codes_to_font(firstAsciiCode, nbCodes, fontCharX, fontCharY)

ParameterDescription
firstAsciiCodefirst ASCII code to map, between 0 and 255.
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.

2.1.3.3 Mapping ASCII code from a string to consecutive characters

C++ : static void TCODConsole::mapStringToFont(const char *s, int fontCharX, int fontCharY)
C   : void TCOD_console_map_string_to_font(const char *s, int fontCharX, int fontCharY)
Py  : console_map_string_to_font(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.
insert a comment