#include "emittor.h"


BasicEmittor::BasicEmittor(void)
{
}
BasicEmittor::~BasicEmittor(void)
{
	for ( int i=0; i< this->particles.size(); ++i)
	{
		delete this->particles[i];
	}

	this->particles.clear();
}

void BasicEmittor::simulate( float dt )
{
	for ( int i=0; i< this->particles.size(); ++i)
	{
		this->particles[i]->simulate( dt );
	}
}

void BasicEmittor::garbageRequest( void )
{
	vector< GraphicParticle* > newContainer;

	for ( int i=0; i< this->particles.size(); ++i)
	{
		if ( this->particles[i]->isAlive() )
		{
			newContainer.push_back( this->particles[i] );
		}
		else
		{
			delete this->particles[i];
		}
	}

	//this->particles.swap( newContainer );
	this->particles = newContainer;
}