So, I have this small class with a collision detection function in it, it's called every frame.
When I run the game I get around 8000 FPS, but when the collision function gets called it drops to 2000.
This is what the function looks like (only called 1 time per frame) The second one is just for overriding.
bool DetectCollision(sf::RectangleShape other)
{
if (entityRect.getGlobalBounds().intersects(other.getGlobalBounds()))
{
// Handle collision here
return true;
}
else
{
return false;
}
}
bool DetectCollision(sf::Sprite other)
{
if (entityRect.getGlobalBounds().intersects(other.getGlobalBounds()))
{
// Handle collision here
return true;
}
else
{
return false;
}
}
Not sure why the FPS drops that much, is this way of detecting collisions heavy for the pc? I'm running a pretty high-end pc.