コード例 #1
0
MOint moTextureManager::AddTexture(moValue* p_value)
{
	moText name = p_value->GetSubValue(0).Text();
	MOuint type = GetTypeForFile(name);
	moTextureMultiple* ptex_mult;
	moMovie* ptex_mov;
	moVideoBuffer* ptex_videobuffer;
	moCircularVideoBuffer* ptex_circularvideobuffer;

	moTexture* ptex = CreateTexture(type, name);
	if (ptex != NULL)
	{
		MOboolean res = false;
		if (type == MO_TYPE_TEXTURE) res = ptex->Load( p_value );
		else if (type == MO_TYPE_TEXTURE_MULTIPLE)
		{
			ptex_mult = (moTextureMultiple*)ptex;
			res = CreateMultipleTex(ptex_mult, p_value);
		}
		else if (type == MO_TYPE_MOVIE)
		{
			ptex_mov = (moMovie*)ptex;
			res = ptex_mov->Load(p_value);
		}
		else if (type == MO_TYPE_VIDEOBUFFER)
		{
			ptex_videobuffer = (moVideoBuffer*)ptex;
			res = ptex_videobuffer->Load(p_value);
		}
		else if (type == MO_TYPE_CIRCULARVIDEOBUFFER)
		{
			ptex_circularvideobuffer = (moCircularVideoBuffer*)ptex;
			res = ptex_circularvideobuffer->Load(p_value);
		}
		if (res)
		{
			m_textures_array.Add(ptex);
			ptex->SetMOId(m_textures_array.Count() - 1);
			return ptex->GetMOId();
		}
		else
		{
			delete ptex;
			return -1;
		}
	}
	else return -1;
}
コード例 #2
0
ファイル: moSoundManager.cpp プロジェクト: moldeo/libmoldeo
MOint
moSoundManager::GetSoundId( moText p_name, bool create ) {

	MOint i,idnuevo;

	for( i=0; i<(int)m_sounds_array.Count(); i++ ) {
		if(!stricmp( m_sounds_array[i]->GetName(), p_name )) {
			return(i);
			break;
		}
	}

  if (!create) return -1;

	moSoundType stype = GetTypeForFile(p_name);
	if (!m_pResourceManager) return MO_SOUNDERROR;

	moText namefull = m_pResourceManager->GetDataMan()->GetDataPath();
	namefull +=  moSlash + (const moText)p_name;

	moFile fileSound(namefull);
	namefull = fileSound.GetCompletePath();

	moSoundParam sparam = MODefSoundParams ;
	moSound* pSound = CreateSound( p_name );

	if (pSound) {

		pSound->LoadFromFile( namefull );

		m_sounds_array.Add( pSound );

		idnuevo = m_sounds_array.Count() - 1;
	} else {
	  idnuevo = -1;
	}
	//si es superior a 65535 es un error
	stype = MO_SOUNDTYPE_UNDEFINED;
	return(idnuevo);
}
コード例 #3
0
MOint moTextureManager::AddTexture(moText p_filename)
{
	moText name = p_filename;
	MOuint type = GetTypeForFile(name);
	moMovie* ptex_mov;

	moTexture* ptex = CreateTexture(type, name);
	p_filename = m_pResourceManager->GetDataMan()->GetDataPath() + moSlash + (moText)p_filename;
	if (ptex != NULL)
	{
		MOboolean res = false;
		if (type == MO_TYPE_TEXTURE) {

		  res = ptex->BuildFromFile(p_filename);

		} else if (type == MO_TYPE_MOVIE)	{

			ptex_mov = (moMovie*)ptex;
			res = ptex_mov->LoadMovieFile(p_filename);

		}


		if (res) {

			m_textures_array.Add(ptex);
			ptex->SetMOId(m_textures_array.Count() - 1);
			return ptex->GetMOId();

		}	else {
			delete ptex;
			return -1;
		}
	}
	else return -1;
}