void Path2dApp::update(){ //cout<<thread.mPoints.size()<<endl; //cout<<(float)app::getFrameRate()<<endl; if(frameCount % 30 == 0){ //float xPos = lerp( windowWidth, 0, pow(0,windowWidth+ 20)); //float xPos = randFloat(windowWidth-20,windowWidth+20); float xPos = randFloat(windowWidth, windowWidth+200); controller->addParticles(NUM_PARTICLES_PER_FRAME, Vec2f(xPos,randFloat(windowHeight*3/8,windowHeight*5/8)), Vec2f(randFloat(),randFloat())); } thread.update(); if(frameCount == 0 || frameCount % 620 == 0){ Content *c = new Content(Vec3f(windowWidth+200,randFloat(windowHeight*3/8, windowHeight*5/8),randFloat(-1.0,-1.0)),postIndex); mContents.push_back(c); postIndex ++; if(postIndex>6) postIndex = 0; } frameCount ++; for(std::list<Content*>::iterator i = mContents.begin(); i!= mContents.end();){ Content *c = (*i); if(c->die()){ i = mContents.erase(i); delete c; }else{ Vec2f steer = c->seek(thread.mPoints); c->addForce(steer); c->update(); ++i; } } double currentTime = app::getElapsedSeconds(); double deltaTime = currentTime - mLastTime; float delta = (float)app::getFrameRate() / (1.0 / deltaTime); mLastTime = currentTime; this->controller->update(delta, mPerlin, thread.mPoints); }