Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - jstasiak

Pages: [1]
1
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:

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(), ...);

Pages: [1]
anything