本文整理汇总了C++中Subsystem::create_tilegraphic方法的典型用法代码示例。如果您正苦于以下问题:C++ Subsystem::create_tilegraphic方法的具体用法?C++ Subsystem::create_tilegraphic怎么用?C++ Subsystem::create_tilegraphic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subsystem
的用法示例。
在下文中一共展示了Subsystem::create_tilegraphic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: png
Font::Font(Subsystem& subsystem, const std::string& filename, ZipReader *zip)
throw (KeyValueException, FontException)
: Properties(filename + ".font", zip), subsystem(subsystem)
{
try {
PNG png(filename + ".png", zip);
/* setup font operations */
FontOperations fo;
if (zip) {
fo.handle = zip;
fo.open = &fo_zip_open;
fo.read = &fo_zip_read;
fo.close = &fo_zip_close;
} else {
fo.handle = 0;
fo.open = &fo_file_open;
fo.read = &fo_file_read;
fo.close = &fo_file_close;
}
std::string font_description = filename + ".fds";
fo.open(fo, font_description);
char header[4];
fo.read(fo, header, sizeof(header));
if (memcmp(header, "FNT1", 4)) {
throw FontException("wrong font file " + font_description);
}
fo.read(fo, &font_height, sizeof font_height);
font_height = ntohl(font_height) * 2;
spacing = atoi(get_value("spacing").c_str());
font_char_t font;
for (int i = 0; i < NumOfChars; i++) {
fo.read(fo, &font, sizeof font);
font.origin_x = ntohl(font.origin_x);
font.origin_y = ntohl(font.origin_y);
font.width = ntohl(font.width);
font.height = ntohl(font.height);
TileGraphic *tg = subsystem.create_tilegraphic(font.width, font.height);
tg->punch_out_tile(png, font.origin_x, font.origin_y, false);
tiles[i] = new Tile(tg, false, Tile::TileTypeNonblocking, 0, false, 0.0f);
fw[i] = font.width;
fh[i] = font.height;
}
} catch (const Exception& e) {
throw FontException(e.what());
}
}