* Loads the font from a YAML file. * @param node YAML node. */
| 65 | * @param node YAML node. |
| 66 | */ |
| 67 | void Font::load(const YAML::Node &node) |
| 68 | { |
| 69 | _width = node["width"].as<int>(_width); |
| 70 | _height = node["height"].as<int>(_height); |
| 71 | _spacing = node["spacing"].as<int>(_spacing); |
| 72 | _monospace = node["monospace"].as<bool>(_monospace); |
| 73 | std::string image = "Language/" + node["image"].as<std::string>(); |
| 74 | |
| 75 | Surface *fontTemp = new Surface(_width, _height); |
| 76 | fontTemp->loadImage(CrossPlatform::getDataFile(image)); |
| 77 | _surface = new Surface(fontTemp->getWidth(), fontTemp->getHeight()); |
| 78 | _surface->setPalette(_palette, 0, 6); |
| 79 | fontTemp->blit(_surface); |
| 80 | delete fontTemp; |
| 81 | init(); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Generates a pre-defined Codepage 437 (MS-DOS terminal) font. |
no test coverage detected