void clParticleEmitter_Sphere::EmitParticles( const clPtr<clParticleSystem>& PS, float DeltaTime ) const
{
	FAccumulatedTime += DeltaTime;

	while (
	   FAccumulatedTime > 1.0f / FEmissionRate &&
	   PS->GetParticles().size() < FMaxParticles )
	{
		FAccumulatedTime -= 1.0f / FEmissionRate;
		sParticle P;

		float Theta = Math::RandomInRange( 0.0f, Math::TWOPI );
		float Phi   = Math::RandomInRange( 0.0f, Math::TWOPI );
		float R     = FRadius;

		float SinTheta = sin( Theta );

		float x = R * SinTheta * cos( Phi );
		float y = R * SinTheta * sin( Phi );
		float z = R * cos( Theta );

		P.FPosition = FCenter + vec3( x, y, z );
		P.FVelocity = vec3( x, y, z ).GetNormalized() * Math::RandomInRange( FRadialVelocityMin, FRadialVelocityMax );
		P.FAcceleration = vec3( 0.0f );
		P.FTTL = Math::RandomInRange( FLifetimeMin, FLifetimeMax );
		P.FLifeTime = P.FTTL;
		P.FRGBA = Math::RandomVector4InRange( FColorMin, FColorMax );
		P.FRGBA.w = 1.0f;
		P.FSize = Math::RandomInRange( FSizeMin, FSizeMax );
		PS->AddParticle( P );
	}
}
Example #2
0
FSTmp::FSTmp(clPtr<FS> _baseFS)
	: FS(TMP)
{
	// to prevent build FSTmp on top of another FSTmp
	if (_baseFS->Type() == FS::TMP)
		baseFS = ((FSTmp*)_baseFS.Ptr())->baseFS;
	else
		baseFS = _baseFS;
}
bool ShouldRemove( const clPtr<iTask> T, size_t ID )
{
	if ( T->GetTaskID() == ID )
	{
		T->Exit();
		return true;
	}

	return false;
}
void clParticleEmitter_Explosion::EmitParticles( const clPtr<clParticleSystem>& PS, float DeltaTime ) const
{
	// emit secondary particles
	auto& Particles = PS->GetParticles();

	size_t OriginalSize = Particles.size();

	for ( size_t i = 0; i != OriginalSize; i++ )
	{
		if ( Particles[i].FRGBA.w > 0.99f && Particles.size() < FMaxParticles )
		{
			// create a secondary particle
			sParticle P;

			P.FPosition = Particles[i].FPosition;
			P.FVelocity = Particles[i].FVelocity * Math::RandomVector3InRange( vec3( 0.1f ), vec3( 1.0f ) );
			P.FAcceleration = FAcceleration;
			P.FTTL = Particles[i].FTTL * 0.5f;
			P.FLifeTime = P.FTTL;
			P.FRGBA = Particles[i].FRGBA * Math::RandomVector4InRange( vec4( 0.5f ), vec4( 0.9f ) );
			P.FRGBA.w = 0.95f;
			P.FSize = Particles[i].FSize * Math::RandomInRange( 0.1f, 0.9f );

			PS->AddParticle( P );
		}
	}

	if ( FEmitted ) { return; }

	FEmitted = true;

	for ( size_t i = 0; i != FEmissionRate; i++ )
	{
		sParticle P;

		float Theta = Math::RandomInRange( 0.0f, Math::TWOPI );
		float Phi   = Math::RandomInRange( 0.0f, Math::TWOPI );

		float SinTheta = sin( Theta );

		float x = SinTheta * cos( Phi );
		float y = SinTheta * sin( Phi );
		float z = cos( Theta );

		P.FPosition = FCenter;
		P.FVelocity = vec3( x, y, z ).GetNormalized() * Math::RandomInRange( FRadialVelocityMin, FRadialVelocityMax );
		P.FAcceleration = FAcceleration;
		P.FTTL = Math::RandomInRange( FLifetimeMin, FLifetimeMax );
		P.FLifeTime = P.FTTL;
		P.FRGBA = Math::RandomVector4InRange( FColorMin, FColorMax );
		P.FRGBA.w = 1.0f;
		P.FSize = Math::RandomInRange( FSizeMin, FSizeMax );
		PS->AddParticle( P );
	}
}
void OnStart( const std::string& RootPath )
{
    g_FrameBuffer = ( unsigned char* )malloc( ImageWidth * ImageHeight * 4 );
    memset( g_FrameBuffer, 0xFF, ImageWidth * ImageHeight * 4 );

    g_FS = new FileSystem();
    g_FS->Mount( "." );
#if defined(ANDROID)
    g_FS->Mount( RootPath );
    g_FS->AddAliasMountPoint( RootPath, "assets" );
#endif
    g_Audio.Start( iThread::Priority_Normal );
    g_Sound.Start( iThread::Priority_Normal );
}
void clCanvas::Rect3D( const LMatrix4& Proj, const LMatrix4& MV,
                       const LVector3& V1,
                       const LVector3& V2,
                       const LVector3& V3,
                       const LVector3& V4,
                       const clPtr<clGLTexture>& Texture,
                       const clPtr<clGLSLShaderProgram>& SP )
{
	LGL3->glDisable( GL_DEPTH_TEST );

	Texture->Bind( 0 );

	clPtr<clGLSLShaderProgram> S = SP ? SP : FRect3DSP;

	S->Bind();
	S->SetUniformNameMat4Array( "u_MVP", 1, MV * Proj );

	FRect3D->Restart( 6 );
	FRect3D->SetTexCoordV( LVector2( 0, 0 ) );
	FRect3D->EmitVertexV( V1 );
	FRect3D->SetTexCoordV( LVector2( 1, 0 ) );
	FRect3D->EmitVertexV( V2 );
	FRect3D->SetTexCoordV( LVector2( 0, 1 ) );
	FRect3D->EmitVertexV( V4 );

	FRect3D->SetTexCoordV( LVector2( 1, 0 ) );
	FRect3D->EmitVertexV( V2 );
	FRect3D->SetTexCoordV( LVector2( 1, 1 ) );
	FRect3D->EmitVertexV( V3 );
	FRect3D->SetTexCoordV( LVector2( 0, 1 ) );
	FRect3D->EmitVertexV( V4 );
	FRect3DVA->SetVertexAttribs( FRect3D );

	FRect3DVA->Draw( false );
}
clPtr<Blob> LoadFileAsBlob( const std::string& FName )
{
	clPtr<iIStream> input = g_FS->CreateReader( FName );
	clPtr<Blob> Res = new Blob();
	Res->CopyMemoryBlock( input->MapStream(), input->GetSize() );
	return Res;
}
clPtr<FS> clArchPlugin::OpenFS( clPtr<FS> Fs, FSPath& Path ) const
{
	FSString Uri = Fs->Uri( Path );

	struct archive* Arch = ArchOpen( Uri.GetUtf8() );

	if ( Arch == nullptr )
	{
		return nullptr;
	}

	FSArchNode RootDir;
	RootDir.fsStat.mode = S_IFDIR;

	FSPath NodePath;
	struct archive_entry* entry = archive_entry_new2( Arch );

	int Res;

	while ( ( Res = archive_read_next_header2( Arch, entry ) ) == ARCHIVE_OK )
	{
		NodePath.Set( CS_UTF8, archive_entry_pathname( entry ) );

		FSString* ItemName = NodePath.GetItem( NodePath.Count() - 1 );

		if ( NodePath.Count() == 1 && ( ItemName->IsDot() || ItemName->IsEmpty() ) )
		{
			// skip root dir
			continue;
		}

		const mode_t Mode = archive_entry_mode( entry );
		const int64_t Size = archive_entry_size( entry );
		RootDir.entryOffset += Size;

		FSStat ItemStat;
		ItemStat.mode = S_ISREG( Mode ) ? Mode : S_IFDIR;
		ItemStat.size = Size;
		ItemStat.m_CreationTime = archive_entry_ctime( entry );
		ItemStat.m_LastAccessTime = archive_entry_atime( entry );
		ItemStat.m_LastWriteTime = archive_entry_mtime( entry );
		ItemStat.m_ChangeTime = ItemStat.m_LastWriteTime;

		FSArchNode* Dir = ArchGetParentDir( &RootDir, NodePath, ItemStat );
		FSArchNode* Item = Dir->Add( FSArchNode( ItemName->GetUtf8(), ItemStat ) );
		if (Item) {
			Item->entryOffset = archive_read_header_position( Arch );
		}
	}

	if ( Res != ARCHIVE_EOF )
	{
		dbg_printf( "Couldn't read archive entry: %s\n", archive_error_string( Arch ) );
	}

	archive_entry_free( entry );
	ArchClose( Arch );

	return new FSArch( RootDir, Uri );
}
Example #9
0
void clExplosion::AttachToScene( const clPtr<clSceneNode>& Scene )
{
	if ( !m_Node )
	{
		m_Node = make_intrusive<clParticleSystemNode>();

		const vec4 Pal[] =
		{
			vec4( 0.2f, 0.30f, 0.8f, 1.0f ),
			vec4( 0.7f, 0.25f, 0.3f, 1.0f ),
			vec4( 0.1f, 0.80f, 0.2f, 1.0f )
		};

		vec4 Color = Pal[ Math::RandomInRange( 0, 3 ) ];

		auto Emitter = make_intrusive<clParticleEmitter_Explosion>();
		Emitter->FCenter = vec3( 0.0f );
		Emitter->FSizeMin = 0.02f;
		Emitter->FSizeMax = 0.05f;
		Emitter->FLifetimeMin = 0.1f;
		Emitter->FLifetimeMax = 1.0f;
		Emitter->FMaxParticles = 10000;
		Emitter->FEmissionRate = 300;
		Emitter->FRadialVelocityMin = 1.0f;
		Emitter->FRadialVelocityMax = 2.0f;
		Emitter->FColorMin = Color;
		Emitter->FColorMax = Color;
		Emitter->FAcceleration = 10.0f * m_ParticleAccel; //vec3( 0.0f, 0.0f, -3.0f );

		m_Node->AddEmitter( Emitter );
	}

	Scene->Add( m_Node );
}
Example #10
0
void FSList::Append( clPtr<FSNode> p )
{
	p->next = 0;

	if ( last )
	{
		last->next = p.ptr();
	}
	else
	{
		first = p.ptr();
	}

	last = p.ptr();
	p.drop();
	count++;
}
Example #11
0
void iSceneTraverser::Traverse( clPtr<clSceneNode> Node )
{
	if ( !Node ) { return; }

	Reset();

	Node->AcceptTraverser( this );
}
void clGallery::ListDownloaded( clPtr<clBlob> B )
{
	if ( B )
	{
		/// Parse the blob
		FURLs.clear();

		void*  Data     = B->GetData();
		size_t DataSize = B->GetSize();

		Picasa_ParseXMLResponse( std::string( ( char* )Data, DataSize ), FURLs );
	}
	else
	{
		FNoImagesList = true;
		return;
	}

	for ( size_t j = 0 ; j != FURLs.size() ; j++ )
	{
		printf( "URL[%d] = %s\n", ( int )j, FURLs[j].c_str() );
	}

	fflush( stdout );

	// теперь что-то создать в FImages ?
	FImages.clear(); // resize(FURLs.size());

	for ( size_t j = 0 ; j != FURLs.size() ; j++ )
	{
		LPhotoSize Size = L_PHOTO_SIZE_128;
		std::string ImgUrl = Picasa_GetDirectImageURL( FURLs[j], Size );

		clPtr<sImageDescriptor> Desc = new sImageDescriptor();
		Desc->FSize    = Size;
		Desc->FURL     = ImgUrl;
		Desc->FID      = j;

		FImages.push_back( Desc );

		// и запустить загрузку
		Desc->StartDownload( true );
	}

	FNoImagesList = false;
}
Example #13
0
void OnStart( const std::string& RootPath )
{
    g_FrameBuffer = ( unsigned char* )malloc( ImageWidth * ImageHeight * 4 );
    memset( g_FrameBuffer, 0x00, ImageWidth * ImageHeight * 4 );

    g_FS = new FileSystem();
    g_FS->Mount( "." );
#if defined(ANDROID)
    g_FS->Mount( RootPath );
    g_FS->AddAliasMountPoint( RootPath, "assets" );
#endif

    g_Flow = new clFlowUI( new clFlowFlinger(), 10 );

    XScale = 25.0f;
    YScale = 5.5f;
    XOfs =
        YOfs = 80.0f;
}
void clCanvas::TextStr( float X1, float Y1, float X2, float Y2, const std::string& Str, int Size, const LVector4& Color, const clPtr<clTextRenderer>& TR, int FontID )
{
	clPtr<clBitmap> B = TR->RenderTextWithFont( Str, FontID, Size, 0xFFFFFFFF, true );
	clPtr<clGLTexture> Texture = new clGLTexture();
	Texture->LoadFromBitmap( B );
	this->TexturedRect2D( X1, Y1, X2, Y2, Color, Texture );

	// make sure we draw everything before detroying the texture
	LGL3->glFinish();
}
Example #15
0
//определяет наличие исполняемого файла в каталогах в PATH
//списки кэшируются
bool ExeFileExist( const char* name )
{
	if ( name[0] == '/' ) //абсолютный путь
	{
		struct stat sb;

		if ( stat( name, &sb ) ) { return false; }

		return true;

		return  ( ( sb.st_mode & S_IFMT ) == S_IFREG && ( sb.st_mode & 0111 ) != 0 );
	}

	if ( !pathExeList.ptr() )
	{
		pathExeList = new cstrhash<bool>;
		const char* pl = getenv( "PATH" );

		if ( !pl ) { return false; }

		std::vector<char> paths = new_char_str( pl );
		char* s = paths.data();

		while ( *s )
		{
			char* t = s;

			while ( *t && *t != ':' ) { t++; }

			if ( *t )
			{
				*t = 0;
				t++;
			}

			SearchExe( s, *( pathExeList.ptr() ) );
			s = t;
		}
	}

	return pathExeList->exist( name ) != 0;
}
Example #16
0
void RenderDirect( clPtr<clFlowUI> Control )
{
    int Num = Control->FNumImg;
    int CurImg = Control->GetCurrentImage();
    float Dist = ( float )( Num * OneImageSize );

    if ( Num < 1 ) {
        return;
    }

    // index = [curr - 2 .. curr + 2]
    /// Left -> Right -> Selected rendering order
    int ImgOrder[] = { CurImg - 3, CurImg - 2, CurImg - 1, CurImg + 3, CurImg + 2, CurImg + 1, CurImg };

    for ( int in_i = 0 ; in_i < 7 ; in_i++ )
    {
        int i = ImgOrder[in_i];

        if ( i < 0 ) {
            i += ( 1 - ( ( int )( i / Num ) ) ) * Num;
        }

        if ( i >= Num ) {
            i -= ( ( int )( i / Num ) ) * Num;
        }

        if ( i < Num && i > -1 )
        {
            vec3 Pt[4];
            Control->QuadCoords( Pt, Control->FFlinger->FValue - ( float )( i ) * OneImageSize );

            vec3 Q[4];

            for ( int j = 0 ; j < 4 ; j++ )
            {
                Q[j] = Control->FProjection * Control->FView * Pt[j];
            }

            BoxR( Q, 0xFFFFFF );
        }
    }
}
void clParticleEmitter_Box::EmitParticles( const clPtr<clParticleSystem>& PS, float DeltaTime ) const
{
	FAccumulatedTime += DeltaTime;

	while (
	   FAccumulatedTime > 1.0f / FEmissionRate &&
	   PS->GetParticles().size() < FMaxParticles )
	{
		FAccumulatedTime -= 1.0f / FEmissionRate;
		sParticle P;
		P.FPosition = Math::RandomVector3InRange( FPosMin, FPosMax );
		P.FVelocity = Math::RandomVector3InRange( FVelMin, FVelMax );
		P.FAcceleration = LVector3( 0.0f );
		P.FTTL = Math::RandomInRange( FLifetimeMin, FLifetimeMax );
		P.FLifeTime = P.FTTL;
		P.FRGBA = Math::RandomVector4InRange( FColorMin, FColorMax );
		P.FRGBA.w = 1.0f;
		P.FSize = Math::RandomInRange( FSizeMin, FSizeMax );
		PS->AddParticle( P );
	}
}
Example #18
0
	void Clear()
	{
		executed = false;
		errorString.Clear();
		srcList.clear();

		pathChanged = false;
//		uint64_t infoCount = 0;
		infoSrcUri.Clear();
		infoDstUri.Clear();
		progressChanged = false;
		infoSize = 0;
		infoProgress = 0;
	}
Example #19
0
void clSpaceShip::AttachToScene( const clPtr<clSceneNode>& Scene )
{
	if ( !m_Node )
	{
		auto Geometry = LoadOBJSceneNode( g_FS->CreateReader( "ship.obj" ) );

		sMaterial Material;
		Material.m_Ambient = vec4( 0.0f, 0.0f, 0.4f, 1.0f );
		Material.m_Diffuse = vec4( 0.0f, 0.0f, 0.6f, 1.0f );

		m_Node = make_intrusive<clMaterialNode>();
		m_Node->SetMaterial( Material );
		m_Node->Add( Geometry );
	}

	Scene->Add( m_Node );
}
void clWorkerThread::AddTask( const clPtr<iTask>& Task )
{
	tthread::lock_guard<tthread::mutex> Lock( FTasksMutex );

	// non-zero IDs should be unique
	if ( size_t ID = Task->GetTaskID() )
	{
		for ( std::list< clPtr<iTask> >::iterator i = FPendingTasks.begin(); i != FPendingTasks.end(); ++i )
		{
			// LASSERT( (*i)->GetTaskID() != ID );
		}
	}

	FPendingTasks.push_back( Task );

	FCondition.notify_all();
}
void clCanvas::TexturedRect2D( float X1, float Y1, float X2, float Y2, const LVector4& Color, const clPtr<clGLTexture>& Texture )
{
	LGL3->glDisable( GL_DEPTH_TEST );

	Texture->Bind( 0 );

	FTexRectSP->Bind();
	FTexRectSP->SetUniformNameVec4Array( "u_Color", 1, Color );
	FTexRectSP->SetUniformNameVec4Array( "u_RectSize", 1, LVector4( X1, Y1, X2, Y2 ) );

	LGL3->glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
	LGL3->glEnable( GL_BLEND );

	FRectVA->Draw( false );

	LGL3->glDisable( GL_BLEND );
}
Example #22
0
void clRocket::AttachToScene( const clPtr<clSceneNode>& Scene )
{
	if ( !m_Node )
	{
		auto VA = clGeomServ::CreateAxisAlignedBox( vec3( -0.02f ), vec3( +0.02f ) );
		auto Geometry = make_intrusive<clGeometryNode>();
		Geometry->SetVertexAttribs( VA );

		sMaterial Material;
		Material.m_Ambient = vec4( 0.8f, 0.0f, 0.0f, 1.0f );
		Material.m_Diffuse = vec4( 0.2f, 0.0f, 0.0f, 1.0f );

		m_Node = make_intrusive<clMaterialNode>();
		m_Node->SetMaterial( Material );
		m_Node->Add( Geometry );
	}

	Scene->Add( m_Node );

	Update( 0.0f );
}
/// Internal routine to extract a single file from ZIP archive
int ExtractCurrentFile_ZIP( unzFile uf, const char* password, int* abort_flag, float* progress, const clPtr<iOStream>& fout )
{
	char filename_inzip[256];
	int err = UNZ_OK;
	void* buf;
	uInt size_buf;
	unz_file_info64 file_info;

	err = unzGetCurrentFileInfo64( uf, &file_info, filename_inzip, sizeof( filename_inzip ), NULL, 0, NULL, 0 );

	if ( err != UNZ_OK ) { return err; }

	uint64 file_size = ( uint64 )file_info.uncompressed_size;
	uint64 total_bytes = 0;

	unsigned char _buf[WRITEBUFFERSIZE];
	size_buf = WRITEBUFFERSIZE;
	buf = ( void* )_buf;

	err = unzOpenCurrentFilePassword( uf, password );

	if ( err != UNZ_OK ) { return err; }

	do
	{
		err = unzReadCurrentFile( uf, buf, size_buf );

		if ( err < 0 ) { break; }

		if ( err > 0 ) { total_bytes += err; fout->Write( buf, err ); }
	}
	while ( err > 0 );

	int close_err = unzCloseCurrentFile ( uf );

	if ( close_err != UNZ_OK ) { return close_err; }

	return err;
}
Example #24
0
bool DirCalc( clPtr<FS> f, FSPath& path, clPtr<FSList> list, NCDialogParent* parent )
{
	bool doCurrentDir = list->Count() == 0;

	OperDirCalcData data(parent, f, path, list);
	DirCalcThreadWin dlg(parent, doCurrentDir ? _LT("Current folder metrics") : _LT("Selected folder(s) metrics"), &data, f->Uri(path).GetUnicode());

	dlg.RunNewThread( "Folder calc", DirCalcThreadFunc, &data ); //может быть исключение

	dlg.Enable();
	dlg.Show();

	int cmd = dlg.DoModal();
	dlg.StopThread();

	if ( cmd != CMD_OK )
	{
		return false;
	}

	return true;
}
Example #25
0
void OperRDThread::Run()
{
	if ( !fs.Ptr() ) { return; }

	int n = 8;
	int ret_err;

	int havePostponedStatError = 0;
	FSString postponedStrError;

	while ( true )
	{
		if ( !( fs->Flags() & FS::HAVE_SYMLINK ) )
		{
			break;
		}

		FSStat st;

		// if path is inaccessible, try .. path. Throw the exception later
		// This makes panel at least having some valid folder
		while ( fs->Stat( path, &st, &ret_err, Info() ) )
		{
			havePostponedStatError = 1;
			postponedStrError = fs->StrError( ret_err );

			if ( !path.IsAbsolute() || path.Count() <= 1 || !path.Pop() )
			{
				throw_msg( "%s", postponedStrError.GetUtf8() );
			}
		}

		// yell immediately if the path is inaccessible (orig behavior)
		//if (fs->Stat(path, &st, &ret_err, Info()))
		// throw_msg("%s", fs->StrError(ret_err).GetUtf8());

		if ( !st.IsLnk() )
		{
			break;
		}

		n--;

		if ( n < 0 )
		{
			throw_msg( "too many symbolic links '%s'", path.GetUtf8() );
		}

		path.Pop();

		if ( !ParzeLink( path, st.link ) )
		{
			throw_msg( "invalid symbolic link '%s'", path.GetUtf8() );
		}
	}

	clPtr<FSList> list = new FSList;

	int havePostponedReadError = 0;

	// if directory is not readable, try .. path. Throw the exception later
	// "Stat" call above does not catch this: it checks only folder existence, but not accessibilly
	while ( fs->ReadDir( list.ptr(), path, &ret_err, Info() ) )
	{
		havePostponedReadError = 1;
		postponedStrError = fs->StrError( ret_err );

		if ( !path.IsAbsolute() || path.Count() <= 1 || !path.Pop() )
		{
			throw_msg( "%s", postponedStrError.GetUtf8() );
		}
	}

	// yell immediately if the dir is unreadable (orig behavior)
	//int ret = fs->ReadDir(list.ptr(), path, &ret_err, Info());
	//if (ret)
	// throw_msg("%s", fs->StrError(ret_err).GetUtf8());

	FSStatVfs vst;
	fs->StatVfs( path, &vst, &ret_err, Info() );

	MutexLock lock( Node().GetMutex() ); //!!!

	if ( Node().NBStopped() ) { return; }

	OperRDData* data = ( ( OperRDData* )Node().Data() );
	data->list = list;
	data->path = path;
	data->executed = true;
	data->vst = vst;

	if ( havePostponedReadError || havePostponedStatError )
	{
		data->nonFatalErrorString = postponedStrError;
	}
}
Example #26
0
void clExplosion::DetachFromScene( const clPtr<clSceneNode>& Scene )
{
	Scene->Remove( m_Node );
}
Example #27
0
static int _GetAppList( const unicode_t* fileName, ccollect<AppNode*>& list )
{
	if ( !mimeDb.ptr() )
	{
		if ( FileIsExist( "/usr/share/mime/globs" ) )
		{
			mimeDb = new MimeDB( "/usr/share/mime/" );
		}
		else
		{
			mimeDb = new MimeDB( "/usr/local/share/mime/" );
		}
	}

	if ( !appDb.ptr() )
	{
		if ( DirIsExist( "/usr/share/applications" ) )
		{
			appDb = new AppDB( "/usr/share/applications/" );
		}
		else
		{
			appDb = new AppDB( "/usr/local/share/applications/" );
		}
	}

	if ( !userDefApp.ptr() )
	{
		const char* home = getenv( "HOME" );

		if ( home )
		{
			userDefApp = new AppDefListFile( carray_cat<char>( home, "/.local/share/applications/mimeapps.list" ).data() );
		}
	}

	mimeDb->Refresh();
	appDb->Refresh();

	if ( userDefApp.ptr() )
	{
		userDefApp->Refresh();
	}

	ccollect<int> mimeList;

	if ( mimeDb->GetMimeList( fileName, mimeList ) )
	{
		int i;
		std::unordered_map<int, bool> hash;

		for ( i = 0; i < mimeList.count(); i++ )
		{
			ccollect<int> appList;

			if ( userDefApp.ptr() )
			{
				userDefApp->GetAppList( mimeList[i], appList );
			}

			appDb->GetAppList( mimeList[i], appList );

			for ( int j = 0; j < appList.count(); j++ )
			{
				bool Exists = hash.find( appList[j] ) != hash.end();
				if ( !Exists )
				{
					hash[appList[j]] = true;

					AppNode* p = appDb->GetApp( appList[j] );

					if ( p && p->exec.data() )
					{
						list.append( p );
					}
				}
			}
		}
	}

	return list.count();
}
Example #28
0
void clRocket::DetachFromScene( const clPtr<clSceneNode>& Scene )
{
	Scene->Remove( m_Node );
}
Example #29
0
void clSpaceShip::DetachFromScene( const clPtr<clSceneNode>& Scene )
{
	Scene->Remove( m_Node );
}
Example #30
0
void clAsteroid::DetachFromScene( const clPtr<clSceneNode>& Scene )
{
	Scene->Remove( m_Node );
}