1
Graphics / Re: Check collision with vector of shapes
« on: April 06, 2016, 03:03:03 pm »
hi, when you need to check any kind of container like a vector or an array you need to loop it , for example :
std::vector<sf::FloatRect>myFloatRects(100); // 100 floatRects of sf::Shape
sf::FloatRect myPosition = myShape.getGlobalBounds();
for(int i = 0; i = myFloatRects.size();i++)
if (myPosition.intersects(myFloatRects[i])){ // if myPosition intersects any of myFloatRects
//do something
}
}
sf::FloatRect myPosition = myShape.getGlobalBounds();
for(int i = 0; i = myFloatRects.size();i++)
if (myPosition.intersects(myFloatRects[i])){ // if myPosition intersects any of myFloatRects
//do something
}
}