本文整理汇总了C++中FileUtils::fileExists方法的典型用法代码示例。如果您正苦于以下问题:C++ FileUtils::fileExists方法的具体用法?C++ FileUtils::fileExists怎么用?C++ FileUtils::fileExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils::fileExists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawCountry
void drawCountry(Renderer* canvas, const Country &country, bool drawDescription) {
/** Title area **/
Font fontCountryName("resources/fonts/FreeSansBold.ttf", 30);
fontCountryName.setColor(Color(0xf0, 0xff, 0xff));
Text name(country.getName(), &fontCountryName);
canvas->drawText(&name, Point(358, 105));
/* Photo area */
string photoPath = "data/countries/" + country.getIsoCode() + "/postal.png";
FileUtils fileUtils;
if (!fileUtils.fileExists(photoPath.c_str())) {
photoPath = "data/countries/default-photo.jpg";
}
Surface photoSurface(photoPath);
photoSurface.transform(4, 1, 1);
Texture photoTexture(canvas->internal, photoSurface.toSDL());
canvas->drawTexture(&photoTexture, Point(47, 115));
Texture polaroidSurf(canvas->internal, "resources/images/game/polaroid.png");
canvas->drawTexture(&polaroidSurf, Point(30, 108));
string flagPath = "data/countries/" + country.getIsoCode() + "/flag.png";
Surface flagSurface(flagPath);
flagSurface.transform(0, .5, 1);
Texture flagTexture(canvas->internal, flagSurface.toSDL());
canvas->drawTexture(&flagTexture, Point(300, 110));
if (drawDescription) {
Font descFont("resources/fonts/FreeSansBold.ttf", 14);
descFont.setColor(Color(0xd3, 0xba, 0xa4));
Text description(country.getDescription(), &descFont);
TextUtils textUtils;
textUtils.drawLines(canvas, description, Point(358, 150), Dimension(360, 340));
}
}