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


C++ FilePtr::Size方法代码示例

本文整理汇总了C++中FilePtr::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePtr::Size方法的具体用法?C++ FilePtr::Size怎么用?C++ FilePtr::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FilePtr的用法示例。


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

示例1: Create

	bool DisplaySurface::Create(const boost::any& _rConfig)
	{
		CreateInfo* pInfo = boost::any_cast<CreateInfo*>(_rConfig);
		FilePtr pFile = NULL;

		bool bResult = (NULL != pInfo);
		{
			pFile = FS::GetRoot()->OpenFile(pInfo->m_strPath, FS::EOpenMode_READBINARY);
			bResult = (NULL != pFile);
		}

		if (false != bResult)
		{
			int sSize = pFile->Size();
			unsigned char* pBuffer = new unsigned char[sSize];
			sSize = pFile->Read(pBuffer, sSize);

			bResult = SUCCEEDED(D3DXGetImageInfoFromFileInMemory(pBuffer, sSize, &m_oInfo));

			if (false != bResult)
			{
				#pragma message(__FUNCTION__" : for better support some image formats must be converted into supported surface format. For example luminance image should be translated into paletted surface.")
				bResult = SUCCEEDED(m_rDisplay.GetDevicePtr()->CreateOffscreenPlainSurface(m_oInfo.Width, m_oInfo.Height, m_oInfo.Format, D3DPOOL_DEFAULT, &m_pSurface, NULL));
			}

			if (false != bResult)
			{
				bResult = SUCCEEDED(D3DXLoadSurfaceFromFileInMemory(m_pSurface, NULL, NULL, pBuffer, sSize, NULL, D3DX_FILTER_NONE, 0xff000000, NULL));
			}

			if (false != bResult)
			{
				m_uBPP = m_rDisplay.GetFormatBitsPerPixel(m_oInfo.Format);
				bResult = (0 != m_uBPP);
			}

			delete[] pBuffer;
			FS::GetRoot()->CloseFile(pFile);
		}

		return bResult;
	}
开发者ID:mentaldease,项目名称:bastionlandscape,代码行数:42,代码来源:Surface.cpp

示例2: Loadfile

		bool Lua::Loadfile(const string& _strFileName, LuaStatePtr _pState)
		{
			FilePtr pFile = FS::GetRoot()->OpenFile(_strFileName, FS::EOpenMode_READTEXT);
			bool bResult = (NULL != pFile);
			if (false != bResult)
			{
				int sSize = pFile->Size();
				char* pSourceCode = new char[sSize + 1];
				sSize = pFile->Read(pSourceCode, sSize);
				FS::GetRoot()->CloseFile(pFile);
				pSourceCode[sSize] = '\0';
				_pState = (NULL == _pState) ? s_pState : _pState;
				const int sResult = _pState->DoString(pSourceCode);
				bResult = (0 == sResult);
				delete[] pSourceCode;
				if (false == bResult)
				{
					OutputError(sResult, _pState);
				}
			}
			return bResult;
		}
开发者ID:mentaldease,项目名称:bastionlandscape,代码行数:22,代码来源:Scripting.cpp


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