本文整理汇总了C++中IResource::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ IResource::GetName方法的具体用法?C++ IResource::GetName怎么用?C++ IResource::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResource
的用法示例。
在下文中一共展示了IResource::GetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compile
void SdlPlatform::Compile(Font *obj)
{
bfs::create_directories(obj->GetOutputPath().parent_path());
IResource *res = const_cast<IResource *>(obj->GetResource());
Image *img = static_cast<Image *>(res);
std::ostringstream cmd;
bfs::path toolPath(this->GetName());
toolPath /= PLATFORM_SDL_FONTGEN_COMMAND;
cmd << toolPath.string() << " \""; // file_string
cmd << obj->GetInputPath() << "\"";
cmd << " \"" << obj->GetName() << "\" " << obj->GetCharacters() << " ";
cmd << obj->GetGlyphWidth() << " " << obj->GetGlyphHeight();
if (obj->IsUsingAtlas())
{
cmd << " \"" << res->GetFilename() << "\" " << img->GetX() << " " << img->GetY();
}
RUN_COMMAND(cmd);
// current cache dump
pCache->Dump();
bfs::path fontXML("tmp/font.xml");
cmd.str("");
cmd << e->bfsExeName.string() << " -i " << fontXML << " -p " << this->GetName();
RUN_COMMAND(cmd);
// updated cache reload
pCache->Reset();
pCache->Load();
bfs::path fontSprite = obj->GetOutputPath();
fontSprite.replace_extension(".sprite");
//bfs::remove(fontXML);
obj->SetSprite(fontSprite);
obj->AddFilePath(fontSprite);
/* build extension tables for languages */
DictionaryMap dict = e->GetDictionaries();
DictionaryMapIterator it = dict.begin();
DictionaryMapIterator end = dict.end();
for (; it != end; ++it)
{
Dictionary *dict = (*it).second;
u32 size = dict->GetExtensionTableSize();
if (size)
{
//std::ostringstream extname;
//extname << "l10n/" << dict->pcGetLanguage() << "/" << obj->GetFilename() << "_ext";
//extname << res->GetName() << "_ext";
std::string extname(res->GetName());
extname += "_ext";
IResource *ext = e->GetResource(extname.c_str(), dict->pcGetLanguage());
//IResource *ext = e->GetResource(res->GetName(), dict->pcGetLanguage());
if (ext)
{
//std::string x(res->GetFilename());
std::ostringstream x;
//x << "l10n/" << dict->pcGetLanguage() << "/" << res->GetName() << "_ext.tga";
x << res->GetName() << "_ext.tga";
bfs::path xx(e->GetOutputPath());
xx /= x.str();
//pCache->AddFilename(xx.string().c_str());
obj->SetExtId(pCache->GetFilenameId(xx.string().c_str()));
std::ostringstream x2;
//x2 << "l10n/" << dict->pcGetLanguage() << "/" << res->GetName() << "_ext.sprite";
x2 << res->GetName() << "_ext.sprite";
xx = e->GetOutputPath();
xx /= x2.str();
pCache->AddFilename(xx.string().c_str());
obj->SetExtId(pCache->GetFilenameId(xx.string().c_str()));
//bfs::path sprite = this->ProcessFont(obj, ext, size);
//obj->AddFilePath(sprite);
this->ProcessFont(obj, ext, size);
std::ostringstream x3;
x3 << "l10n/" << dict->pcGetLanguage() << "/" << res->GetName() << "_ext.sprite";
xx = e->GetOutputPath();
xx /= x3.str();
obj->AddFilePath(xx.string().c_str());
}
else
{
//Error(ERROR_UNKNOWN, TAG "Needed language '%s' resource extension table %s for font %s not found.", dict->pcGetLanguage(), extname.c_str(), obj->GetName());
//Error(ERROR_UNKNOWN, TAG "Needed language '%s' specific resource for font %s not found.", dict->pcGetLanguage(), obj->GetName());
}
}
}
}
示例2: Compile
void WiiPlatform::Compile(Font *obj)
{
bfs::create_directories(obj->GetOutputPath().parent_path());
IResource *res = const_cast<IResource *>(obj->GetResource());
Image *img = static_cast<Image *>(res);
std::ostringstream cmd;
bfs::path toolPath(this->GetName());
toolPath /= PLATFORM_WII_FONTGEN_COMMAND;
cmd << toolPath.string() << " \""; // file_string
cmd << obj->GetInputPath() << "\"";
cmd << " \"" << obj->GetName() << "\" " << obj->GetCharacters();
if (obj->IsUsingAtlas())
{
cmd << " \"" << res->GetFilename() << "\" " << img->GetX() << " " << img->GetY();
}
RUN_COMMAND(cmd);
// current cache dump
pCache->Dump();
bfs::path fontXML("tmp/font.xml");
cmd.str("");
cmd << e->bfsExeName.string() << " -i " << fontXML << " -p " << this->GetName();
RUN_COMMAND(cmd);
// updated cache reload
pCache->Reset();
pCache->Load();
bfs::path fontSprite = obj->GetOutputPath();
fontSprite.replace_extension(".sprite");
bfs::remove(fontXML);
obj->SetSprite(fontSprite);
obj->AddFilePath(fontSprite);
/*if (e->IsCompressionEnabled())
{
// .font
bfs::path pathNewExtension = obj->GetOutputPath();
pathNewExtension.replace_extension(".lzf");
cmd.str("");
cmd << (wiiToolPath / LZFTOOL).string() << " \"" << obj->GetOutputPath() << "\" \"" << pathNewExtension << "\""; // file_string
DebugInfo("CMD: %s\n", cmd.str().c_str());
cmdRetCode = system(cmd.str().c_str());
if (cmdRetCode)
{
fprintf(stderr, "%s didn't execute properly. Return code: %d.\n", LZFTOOL, cmdRetCode);
//exit(EXIT_FAILURE);
}
bfs::remove(obj->GetOutputPath());
bfs::rename(pathNewExtension, obj->GetOutputPath());
// .sprite
pathNewExtension = fontSprite;
pathNewExtension.replace_extension(".lzf");
cmd.str("");
cmd << (wiiToolPath / LZFTOOL).string() << " \"" << fontSprite << "\" \"" << pathNewExtension << "\""; // file_string
DebugInfo("CMD: %s\n", cmd.str().c_str());
cmdRetCode = system(cmd.str().c_str());
if (cmdRetCode)
{
fprintf(stderr, "%s didn't execute properly. Return code: %d.\n", LZFTOOL, cmdRetCode);
//exit(EXIT_FAILURE);
}
bfs::remove(fontSprite);
bfs::rename(pathNewExtension, fontSprite);
}*/
/* build extension tables for languages */
DictionaryMap dict = e->GetDictionaries();
DictionaryMapIterator it = dict.begin();
DictionaryMapIterator end = dict.end();
for (; it != end; ++it)
{
Dictionary *dict = (*it).second;
u32 size = dict->GetExtensionTableSize();
if (size)
{
//std::ostringstream extname;
//extname << "l10n/" << dict->pcGetLanguage() << "/" << obj->GetFilename() << "_ext";
//IResource *ext = e->GetResource(extname.str().c_str());
std::string extname(res->GetName());
extname += "_ext";
IResource *ext = e->GetResource(extname.c_str(), dict->pcGetLanguage());
//IResource *ext = e->GetResource(res->GetName(), dict->pcGetLanguage());
if (ext)
{
std::string x(res->GetFilename());
//.........这里部分代码省略.........