Kto mi pomoze najst chybu, uz mam toho dost :(:
float TD = ogeGetTimeDelta();
ogeColor4f ColorAdd = ( ParticleEndColor - ParticleStartColor ) * TD;
int CurrentLastParticle = 0;
for( int i = 0; i < Particles_Count; i++)
{
Particles[i].Life -= TD;
if( Particles[i].Life > 0 )
{
Particles[CurrentLastParticle] = Particles[i];
CurrentLastParticle++;
Particles[CurrentLastParticle].Color += ColorAdd * Particles[CurrentLastParticle].ColorChangeMultiplier;
}
}
std::cout << TimeElapsed << std::endl;
// Calculate particle creation number
TimeElapsed += TD;
std::cout << TimeElapsed << std::endl;
float PCT = 1.0f / this->ParticlesPerSecond; // Particle Creation Time
int P_TO_CREATE = int(floor(TimeElapsed / PCT));
TimeElapsed -= P_TO_CREATE * PCT;
std::cout << TimeElapsed << std::endl;
std::cout << P_TO_CREATE << std::endl;
Particles_Count = CurrentLastParticle + P_TO_CREATE;
if( Particles_Count > Particles_Legth )
{
Particles_Legth = Particles_Count;
Particles = (ogeParticle2D*) realloc( Particles, Particles_Legth * sizeof( ogeParticle2D ) );
}
for( ; CurrentLastParticle < Particles_Count; CurrentLastParticle++)
{
Particles[CurrentLastParticle].Position.X = this->Position.X + rand()%int(this->Size.X);
Particles[CurrentLastParticle].Position.Y = this->Position.Y + rand()%int(this->Size.Y);
Particles[CurrentLastParticle].Color = ParticleStartColor;
Particles[CurrentLastParticle].Life = ParticleTime;
Particles[CurrentLastParticle].ColorChangeMultiplier = 1 / ParticleTime;
//TimeElapsed -= PCT;
}
vopred dakujem aspon za snahu
EDIT: Hodi mi to chybu az po chvili