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)
Parameter | Description |
---|---|
asciiCode | ASCII code to map. |
fontCharX,fontCharY | Coordinate 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)
Parameter | Description |
---|---|
firstAsciiCode | first ASCII code to map |
nbCodes | number of consecutive ASCII codes to map |
fontCharX,fontCharY | coordinate 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)
Parameter | Description |
---|---|
s | string containing the ASCII codes to map |
fontCharX,fontCharY | coordinate of the character in the bitmap font (in characters, not pixels) corresponding to the first ASCII code in the string |