No, did not work
Here i at the elements:
if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
sf::Vector2f temp;
temp.x = window.mapPixelToCoords(sf::Mouse::getPosition(window)).x;
temp.y = window.mapPixelToCoords(sf::Mouse::getPosition(window)).y;
_PAR._ADDPARTICLE("SPARK", 10, 20, 0, "Images/SPARK.png", temp, 20, 0);
}
if(_Data._Type == "SPARK")
{
for(unsigned int i = 0; i < counter; i++)
{
unsigned int _Direction = rand()%360;
_Data._Direction = _Direction;
_Data._Sprite.setRotation(_Direction);
_AllParticle.insert(_AllParticle.begin(),_Data);
}
}
at the same time this funktion checks the lifetime:
if(_Timer.getElapsedTime().asMilliseconds() >= 100)
{
_Timer.restart();
for(unsigned int o = 0; o < _AllParticle.size(); ++o)
{
static float value = _AllParticle[o]._LifeTime/2.f;
_AllParticle[o]._LifeTime -= 0.1f;
if(_AllParticle[o]._LifeTime <= value)
{
_AllParticle[o]._Alpha -= _AllParticle[o]._Alpha / _AllParticle[o]._LifeTime;
_AllParticle[o]._Sprite.setColor(sf::Color(255,255,255, _AllParticle[o]._Alpha));
}
}
}
But booth things does not work at the same time, if i add something the check function is waiting until i release the mousebutton.