コード例 #1
0
bool CMyApp::CheckLoad()
{
	if(m_ParaEngine_plugin.IsValid())
	{
		return true;
	}

#ifdef _DEBUG
	// post_fix with _d
	m_ParaEngine_plugin.Init("ParaEngineClient_d.dll"); 
#else
	m_ParaEngine_plugin.Init("ParaEngineClient.dll");
#endif

	int nClassCount = m_ParaEngine_plugin.GetNumberOfClasses();
	for (int i=0; i<nClassCount; ++i)
	{
		ClassDescriptor* pDesc = m_ParaEngine_plugin.GetClassDescriptor(i);
		if(pDesc)
		{
			if(strcmp(pDesc->ClassName(), "ParaEngine") == 0)
			{
				m_pParaEngine = (ParaEngine::IParaEngineCore*)(pDesc->Create());
			}
		}
	}
	return m_ParaEngine_plugin.IsValid();
}
コード例 #2
0
ファイル: AudioEngine2.cpp プロジェクト: LiXizhi/NPLRuntime
HRESULT ParaEngine::CAudioEngine2::InitAudioEngine(IParaAudioEngine* pInteface)
{
	if (pInteface != 0)
	{
		SAFE_RELEASE(m_pAudioEngine);
		m_pAudioEngine = pInteface;
	}
	else if(m_pAudioEngine == 0)
	{
		DLLPlugInEntity* pPluginEntity = CGlobals::GetPluginManager()->LoadDLL("audioengine", AUDIO_ENGINE_DLL_PATH);
		if(pPluginEntity!=0)
		{
			for (int i=0; i < pPluginEntity->GetNumberOfClasses(); ++i)
			{
				ClassDescriptor* pClassDesc = pPluginEntity->GetClassDescriptor(i);

				if(pClassDesc && pClassDesc->ClassID()==AudioEngine_CLASS_ID)
				{
					m_pAudioEngine = (IParaAudioEngine*) pClassDesc->Create();
				}
			}
		}
	}
	if (m_pAudioEngine == 0)
	{
		OUTPUT_LOG("error: failed loading audio plugin %s\n", AUDIO_ENGINE_DLL_PATH);
	}
	else
	{
		//Allow the user to choose a playback device
		OUTPUT_LOG("Available Audio Playback Devices: \n");
		unsigned int deviceCount = m_pAudioEngine->getAvailableDeviceCount();
		std::string defaultDeviceName = m_pAudioEngine->getDefaultDeviceName();
		for (unsigned int i = 0; i < deviceCount; ++i)
		{
			std::string deviceName = m_pAudioEngine->getAvailableDeviceName(i);
			if (deviceName.compare(defaultDeviceName) == 0)
			{
				OUTPUT_LOG("%d : %s [DEFAULT]\n", i, StringHelper::AnsiToUTF8(deviceName.c_str()));
			}
			else
			{
				OUTPUT_LOG("%d : %s\n", i, StringHelper::AnsiToUTF8(deviceName.c_str()));
			}
		}
		unsigned int deviceSelection = 0;
		//Initialize the manager with the user settings
		m_pAudioEngine->initialize(m_pAudioEngine->getAvailableDeviceName(deviceSelection));

		// use linear distance model by default. 
		m_pAudioEngine->SetDistanceModel(Audio_DistModel_LINEAR_DISTANCE_CLAMPED);

		// tell to use left handed coordinate system, which will invert the z axis. 
		m_pAudioEngine->SetCoordinateSystem(0);
	}
	return (m_pAudioEngine!=0) ? S_OK : E_FAIL;
}
コード例 #3
0
IMovieCodec* CMoviePlatform::GetMovieCodec(bool bCreateIfNotExist)
{
	if (m_pMovieCodec)
	{
		return m_pMovieCodec;
	}
	else
	{
		static bool s_bIsLoaded = false;
		if (s_bIsLoaded || !bCreateIfNotExist)
		{
			return m_pMovieCodec;
		}
		else
		{
			s_bIsLoaded = true;

			ParaEngine::DLLPlugInEntity* pPluginEntity = NULL;
			for (int i = 0; m_pMovieCodec == 0 && i < sizeof(MOVIE_CODEC_DLL_FILE_PATHS) / sizeof(const char*); ++i)
			{
				const char* sFilename = MOVIE_CODEC_DLL_FILE_PATHS[i];

				pPluginEntity = CGlobals::GetPluginManager()->GetPluginEntity(sFilename);

				if (pPluginEntity == 0)
				{
					// load the plug-in if it has never been loaded before. 
					pPluginEntity = ParaEngine::CGlobals::GetPluginManager()->LoadDLL("", sFilename);
				}

				if (pPluginEntity != 0 && pPluginEntity->IsValid())
				{
					if (pPluginEntity->GetLibVersion() >= 3)
					{
						for (int i = 0; i < pPluginEntity->GetNumberOfClasses(); ++i)
						{
							ClassDescriptor* pClassDesc = pPluginEntity->GetClassDescriptor(i);

							if (pClassDesc && pClassDesc->ClassID() == MovieCodec_CLASS_ID)
							{
								m_pMovieCodec = (IMovieCodec*)pClassDesc->Create();
							}
						}
					}
					else
					{
						OUTPUT_LOG("movie codec require at least version 3 but you only have version %d\n", pPluginEntity->GetLibVersion());
						CGlobals::GetApp()->SystemMessageBox("MovieCodec plugin needs at least version 3. Please update from official website!");
					}
				}
			}
		}
		return m_pMovieCodec;
	}
}
コード例 #4
0
ファイル: descriptor.hpp プロジェクト: 8l/Mach7
 bool operator<(const ClassDescriptor& cd) const 
 { 
     if (this == &cd)
         return false;
     else
         return is_derived_from(&cd) || (!cd.is_derived_from(this) && name < cd.name);
 }