1
Feature requests / Just-a-little-shorter way of getting corners of Rect<T>
« on: April 12, 2010, 01:29:48 pm »
In my code I pretty often use rects and calculate their corners, this is why I use a subclass of Rect<T> class to get following behaviour:
I believe it could be useful to add it to SFML. It makes code like
a little shorter:
Code: [Select]
template <typename T>
sf::Vector2<T> Rect<T>::GetP1() const
{
return Vector2<T>(Left, Top);
}
template <typename T>
sf::Vector2<T> Rect<T>::GetP2() const
{
return Vector2<T>(Right, Bottom);
}
I believe it could be useful to add it to SFML. It makes code like
Code: [Select]
Rectangle(rect.left, rect.top, rect.right, rect.bottom, ...);
// or
Rectangle(Vector2f(rect.left, rect.top), Vector2f(rect.right, rect.bottom), ...);
a little shorter:
Code: [Select]
Rectangle(rect.GetP1(), rect.GetP2(), ...);