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


C++ platform::FileManagerPtr类代码示例

本文整理汇总了C++中platform::FileManagerPtr的典型用法代码示例。如果您正苦于以下问题:C++ FileManagerPtr类的具体用法?C++ FileManagerPtr怎么用?C++ FileManagerPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FileManagerPtr类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fullHdVersionFileName

gs2d::str_type::string ETHSpriteDensityManager::ChooseSpriteVersion(const gs2d::str_type::string& fullFilePath,
										   const gs2d::VideoPtr& video, ETHSpriteDensityManager::DENSITY_LEVEL& densityLevel)
{
	const Platform::FileManagerPtr fileManager = video->GetFileManager();
	const bool shouldUseFullHdResources = ShouldUseFullHdResources(video);
	if (shouldUseFullHdResources)
	{
		const string fullHdVersionFileName(AssembleResourceName(fullFilePath, FULL_HD_VERSION_PATH_NAME));
		if (fileManager->FileExists(fullHdVersionFileName))
		{
			densityLevel = ETHSpriteDensityManager::FULL_HD;
			return fullHdVersionFileName;
		}
	}

	if (ShouldUseHdResources(video) || shouldUseFullHdResources)
	{
		const string hdVersionFileName(AssembleResourceName(fullFilePath, HD_VERSION_PATH_NAME));
		if (fileManager->FileExists(hdVersionFileName))
		{
			densityLevel = ETHSpriteDensityManager::HD;
			return hdVersionFileName;
		}
	}

	densityLevel = ETHSpriteDensityManager::DEFAULT;
	return fullFilePath;
}
开发者ID:AlternatingCt,项目名称:ethanon,代码行数:28,代码来源:ETHSpriteDensityManager.cpp

示例2: doc

ETHEntityProperties::ETHEntityProperties(const str_type::string& filePath, const Platform::FileManagerPtr& fileManager)
{
	ETHEntityMaterial::Reset();
	Reset();

	TiXmlDocument doc(filePath);
	str_type::string content;
	fileManager->GetUTF16FileString(filePath, content);
	if (!doc.LoadFile(content, TIXML_ENCODING_LEGACY))
	{
		ETH_STREAM_DECL(ss) << GS_L("Couldn't load file: ") << filePath;
		ETHResourceProvider::Log(ss.str(), Platform::Logger::ERROR);
		return;
	}

	TiXmlHandle hDoc(&doc);
	TiXmlHandle hRoot(0);

	TiXmlElement *pElem = hDoc.FirstChildElement().Element();
	if (!pElem)
	{
		ETH_STREAM_DECL(ss) << GS_L("The current file seems to be invalid: ") << filePath;
		ETHResourceProvider::Log(ss.str(), Platform::Logger::ERROR);
		return;
	}

	hRoot = TiXmlHandle(pElem);
	entityName = Platform::GetFileName(filePath);
	if (ReadFromXMLFile(hRoot.FirstChildElement().Element()))
	{
		successfullyLoaded = true;
	}
}
开发者ID:ArthurCalazans,项目名称:ethanon,代码行数:33,代码来源:ETHEntityProperties.cpp

示例3: file

ETH_WINDOW_ENML_FILE::ETH_WINDOW_ENML_FILE(const str_type::string& fileName, const Platform::FileManagerPtr& fileManager)
{
    width = 640;
    height = 480;
    windowed = true;
    vsync = true;
    title = GS_L("Ethanon Engine");

    str_type::string out;
    fileManager->GetAnsiFileString(fileName, out);
    enml::File file(out);
    if (file.getError() == enml::enmlevSUCCESS)
    {
        file.getUInt(GS_L("window"), GS_L("width"), &width);
        file.getUInt(GS_L("window"), GS_L("height"), &height);
        windowed = (file.get(GS_L("window"), GS_L("windowed")) == GS_L("false")) ? false : true;
        vsync = (file.get(GS_L("window"), GS_L("vsync")) == GS_L("false")) ? false : true;

        const str_type::string newTitle = file.get(GS_L("window"), GS_L("title"));
        title = newTitle.empty() ? title : newTitle;
    }
    else
    {
#ifdef GS2D_STR_TYPE_WCHAR
        std::wcerr
#else
        std::cerr
#endif
                << file.getErrorString() << std::endl;
    }
}
开发者ID:andresan87,项目名称:Torch,代码行数:31,代码来源:ETHCommon.cpp

示例4: file

ETH_WINDOW_ENML_FILE::ETH_WINDOW_ENML_FILE(const str_type::string& fileName, const Platform::FileManagerPtr& fileManager) :
	width(640),
	height(480),
	windowed(true),
	vsync(true),
	title(GS_L("Ethanon Engine")),
	richLighting(true)
{
	str_type::string out;
	fileManager->GetAnsiFileString(fileName, out);
	enml::File file(out);
	if (file.getError() == enml::enmlevSUCCESS)
	{
		file.getUInt(GS_L("window"), GS_L("width"), &width);
		file.getUInt(GS_L("window"), GS_L("height"), &height);
		windowed = ETHGlobal::IsTrue(file.get(GS_L("window"), GS_L("windowed")));
		vsync = ETHGlobal::IsTrue(file.get(GS_L("window"), GS_L("vsync")));
		const str_type::string newTitle = file.get(GS_L("window"), GS_L("title"));
		richLighting = ETHGlobal::IsTrue(file.get(GS_L("rendering"), GS_L("richLighting")));
		title = newTitle.empty() ? title : newTitle;

		densityManager.FillParametersFromFile(file);
	}
	else
	{
		#ifdef GS2D_STR_TYPE_WCHAR
		std::wcerr
		#else
		std::cerr
		#endif
		 << file.getErrorString() << std::endl;
	}
}
开发者ID:AlternatingCt,项目名称:ethanon,代码行数:33,代码来源:ETHCommon.cpp

示例5: LoadFromFile

bool ETHScene::LoadFromFile(const str_type::string& fileName)
{
	Platform::FileManagerPtr fileManager = m_provider->GetVideo()->GetFileManager();

	// load the scene from a file
	{
		Platform::FileBuffer file;
		fileManager->GetFileBuffer(fileName, file);
		if (!file)
		{
			ETH_STREAM_DECL(ss) << GS_L("ETHScene::Open: file not found (") << fileName << GS_L(")");
			m_provider->Log(ss.str(), Platform::FileLogger::ERROR);
			return false;
		}
	}
	m_minSceneHeight = 0.0f;
	m_maxSceneHeight = m_provider->GetVideo()->GetScreenSizeF().y;

	// Read the header and check if the file is valid
	TiXmlDocument doc(fileName);
	str_type::string content;
	fileManager->GetUTF16FileString(fileName, content);
	if (!doc.LoadFile(content, TIXML_ENCODING_LEGACY))
	{
		ETH_STREAM_DECL(ss) << GS_L("ETHScene::Open: file found, but parsing failed (") << fileName << GS_L(")");
		m_provider->Log(ss.str(), Platform::FileLogger::ERROR);
		return false;
	}

	TiXmlHandle hDoc(&doc);
	TiXmlHandle hRoot(0);

	TiXmlElement *pElement = hDoc.FirstChildElement().Element();
	if (!pElement)
	{
		ETH_STREAM_DECL(ss) << GS_L("ETHScene::Open: couldn't find root element (") << fileName << GS_L(")");
		m_provider->Log(ss.str(), Platform::FileLogger::ERROR);
		return false;
	}
	return ReadFromXMLFile(pElement);
}
开发者ID:andresan87,项目名称:Torch,代码行数:41,代码来源:ETHScene.cpp

示例6: SaveToFile

bool ETHEntityProperties::SaveToFile(const str_type::string& filePath, const Platform::FileManagerPtr& fileManager)
{
	GS2D_UNUSED_ARGUMENT(fileManager);
	TiXmlDocument doc;
	TiXmlDeclaration *pDecl = new TiXmlDeclaration(GS_L("1.0"), GS_L(""), GS_L(""));
	doc.LinkEndChild(pDecl);

	TiXmlElement *pElement = new TiXmlElement(GS_L("Ethanon"));
	doc.LinkEndChild(pElement);

	WriteToXMLFile(doc.RootElement());
	doc.SaveFile(filePath);
	#ifdef GS2D_STR_TYPE_ANSI
	  fileManager->ConvertAnsiFileToUTF16LE(filePath);
	#endif
	return true;
}
开发者ID:ArthurCalazans,项目名称:ethanon,代码行数:17,代码来源:ETHEntityProperties.cpp

示例7: ReadFromFile

bool ETHParticleSystem::ReadFromFile(const str_type::string& fileName, const Platform::FileManagerPtr& fileManager)
{
	TiXmlDocument doc(fileName);
	str_type::string content;
	fileManager->GetUTFFileString(fileName, content);
	if (!doc.LoadFile(content, TIXML_ENCODING_LEGACY))
		return false;

	TiXmlHandle hDoc(&doc);
	TiXmlHandle hRoot(0);

	TiXmlElement *pElem = hDoc.FirstChildElement().Element();
	if (!pElem)
		return false;

	hRoot = TiXmlHandle(pElem);

	return ReadFromXMLFile(hRoot.FirstChildElement().Element());
}
开发者ID:CeroOscura,项目名称:ethanon,代码行数:19,代码来源:ETHParticleSystem.cpp

示例8: CreateParticleSystem

bool ETHParticleManager::CreateParticleSystem(
	const ETHParticleSystem& partSystem,
	const Vector2& v2Pos,
	const Vector3& v3Pos,
	const float angle,
	const float entityVolume,
	const float scale)
{
	GS2D_UNUSED_ARGUMENT(v3Pos);
	if (partSystem.nParticles <= 0)
	{
		ETH_STREAM_DECL(ss) << GS_L("ETHParticleManager::CreateParticleSystem: The number of particles must be greater than 0.");
		m_provider->Log(ss.str(), Platform::FileLogger::ERROR);
		return false;
	}

	m_finished = false;
	m_killed = false;
	m_nActiveParticles = 0;
	m_soundVolume = 1.0f;
	m_isSoundLooping = false;
	m_isSoundStopped = false;
	m_generalVolume = 1.0f;
	m_system = partSystem;
	m_entityVolume = entityVolume;

	m_system.Scale(scale);

	if (m_system.bitmapFile.empty())
	{
		m_system.bitmapFile = ETH_DEFAULT_PARTICLE_BITMAP;
	}

	ETHGraphicResourceManagerPtr graphics = m_provider->GetGraphicResourceManager();
	ETHAudioResourceManagerPtr samples = m_provider->GetAudioResourceManager();
	Platform::FileIOHubPtr fileIOHub = m_provider->GetFileIOHub();
	Platform::FileManagerPtr fileManager = m_provider->GetFileManager();

	// if there's no resource path, search the current module's path
	const str_type::string& resourcePath = fileIOHub->GetResourceDirectory();
	const str_type::string& programPath  = fileIOHub->GetProgramDirectory();
	const str_type::string currentPath = (resourcePath.empty() && !fileManager->IsPacked()) ? programPath : resourcePath;

	m_pBMP = graphics->GetPointer(m_provider->GetVideo(), m_system.bitmapFile, currentPath,
		ETHDirectories::GetParticlesDirectory(), (m_system.alphaMode == Video::AM_ADD));

	// find the particle sound effect
	if (m_system.soundFXFile != GS_L(""))
	{
		m_pSound = samples->GetPointer(m_provider->GetAudio(), m_provider->GetFileIOHub(), m_system.soundFXFile,
			ETHDirectories::GetSoundFXDirectory(), Audio::SOUND_EFFECT);
	}

	if (m_system.allAtOnce)
	{
		m_nActiveParticles = m_system.nParticles;
	}
	else
	{
		m_nActiveParticles = 0;
	}

	m_particles.resize(m_system.nParticles);

	Matrix4x4 rot = RotateZ(DegreeToRadian(angle));
	for (int t = 0; t < m_system.nParticles; t++)
	{
		m_particles[t].id = t;
		m_particles[t].released = false;
		ResetParticle(t, v2Pos, Vector3(v2Pos,0), angle, rot);
	}
	return true;
}
开发者ID:angeltown,项目名称:ethanon,代码行数:73,代码来源:ETHParticleManager.cpp


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