![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Takes care of loading and storing each character in a sprite font. More...
#include <Font.h>
Public Member Functions | |
Font () | |
Creates a blank font. More... | |
~Font () | |
Cleans up the font. More... | |
void | load (const YAML::Node &node) |
Loads the font from YAML. More... | |
void | loadTerminal () |
Generate the terminal font. More... | |
Surface * | getChar (UCode c) |
Gets a particular character from the font, with its real size. More... | |
int | getWidth () const |
Gets the font's character width. More... | |
int | getHeight () const |
Gets the font's character height. More... | |
int | getSpacing () const |
Gets the spacing between characters. More... | |
SDL_Rect | getCharSize (UCode c) |
Gets the size of a particular character;. More... | |
SDL_Color * | getPalette () const |
Gets the font's palette. More... | |
void | setPalette (SDL_Color *colors, int firstcolor, int ncolors) |
Sets the font's palette. More... | |
Takes care of loading and storing each character in a sprite font.
Sprite fonts consist of a set of characters split in fixed-size regions.
OpenXcom::Font::Font | ( | ) |
Creates a blank font.
Initializes the font with a blank surface.
OpenXcom::Font::~Font | ( | ) |
Cleans up the font.
Deletes the font's surface.
Surface * OpenXcom::Font::getChar | ( | UCode | c | ) |
Gets a particular character from the font, with its real size.
Returns a particular character from the set stored in the font.
c | Character to use for size/position. |
SDL_Rect OpenXcom::Font::getCharSize | ( | UCode | c | ) |
Gets the size of a particular character;.
Returns the dimensions of a particular character in the font.
c | Font character. |
int OpenXcom::Font::getHeight | ( | ) | const |
Gets the font's character height.
Returns the maximum height for any character in the font.
SDL_Color * OpenXcom::Font::getPalette | ( | ) | const |
Gets the font's palette.
Returns the font's 8bpp palette.
int OpenXcom::Font::getSpacing | ( | ) | const |
Gets the spacing between characters.
Returns the spacing between any character in the font.
int OpenXcom::Font::getWidth | ( | ) | const |
Gets the font's character width.
Returns the maximum width for any character in the font.
void OpenXcom::Font::load | ( | const YAML::Node & | node | ) |
Loads the font from YAML.
Loads the font from a YAML file.
node | YAML node. |
void OpenXcom::Font::loadTerminal | ( | ) |
Generate the terminal font.
Generates a pre-defined Codepage 437 (MS-DOS terminal) font.
void OpenXcom::Font::setPalette | ( | SDL_Color * | colors, |
int | firstcolor, | ||
int | ncolors | ||
) |
Sets the font's palette.
Replaces a certain amount of colors in the font's palette.
colors | Pointer to the set of colors. |
firstcolor | Offset of the first color to replace. |
ncolors | Amount of colors to replace. |