Hiya,
In most of my games involving an sf::View, I write a little function that looks somewhat like:
sf::FloatRect getViewBounds(const sf::View &view)
{
sf::FloatRect rt;
rt.left = view.getCenter().x - view.getSize().x/2.f;
rt.top = view.getCenter().y - view.getSize().y/2.f;
rt.width = view.getSize().x;
rt.height = view.getSize().y;
return rt;
}
As you can guess, it returns an
sf::FloatRect containing information on the bounds of a given
sf::View. This function has many uses, such as checking if something is on-screen or not using
sf::Rect's very useful
.contains() and
.intersects() functions.
My feature request is to ask if such a thing could be stuck into sf::View by default, as it has many uses and it's pretty essential for game development, in my opinion.
Thanks,
Aster