当前位置: 首页>>代码示例>>C++>>正文


C++ IResource::GetName方法代码示例

本文整理汇总了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());
			}
		}
	}
}
开发者ID:fungos,项目名称:seed1_tools,代码行数:97,代码来源:sdlplatform.cpp

示例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());
//.........这里部分代码省略.........
开发者ID:fungos,项目名称:seed1_tools,代码行数:101,代码来源:wiiplatform.cpp


注:本文中的IResource::GetName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。