Hello yeah I know again a thread but I think here it's better placed.
I'm measuring time with an sf::clock
t3=mClock2.restart().asSeconds();
draw(asteroids,bullets,ship,window,BgSprite);
t4=mClock2.restart().asSeconds();
like that I get the delta t used for this function, except I'm terribly wrong.
now like I said in the other thread I have lag issues. Because sometimes t4 jumps to 120 ms.
so what does this draw function?
void draw(std::vector<Asteroid>& asteroids, std::vector<Bullet>& bullets, SpaceShip& ship, RenderWindow& window, Sprite& BgSprite)
{
window.clear();
window.draw(BgSprite);
for(b_it=bullets.begin(); b_it!=bullets.end();)
{
b_it->Draw(window);
++b_it;
}
for(a_it=asteroids.begin(); a_it!=asteroids.end();)
{
a_it->Draw(window);
++a_it;
}
ship.Draw(window);
}
Well not much at all, I handle over the vectors with the asteroids & bullets, my ship , my background and my render window.
The Draw(window) are just drawing the sprites to die render window.
I'm not sure that I pass the vectors the best way, but if you have an idea what it could be tell me.
Again sorting out the main problem these few lines of codes take sometimes (most of the time not) above 1/10 of a second.
thank you in advance