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

Author Topic: sf::Shape::Rectangle that takes a FloatRect  (Read 3332 times)

0 Members and 1 Guest are viewing this topic.

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
sf::Shape::Rectangle that takes a FloatRect
« on: May 07, 2009, 08:35:26 pm »
It's really simple, but I find myself an awfull lot of times calling:
sf::Shape::Rectangle(r.Left, r.Top, r.Right, r.Bottom, ...)

Thanks
-Martín

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::Shape::Rectangle that takes a FloatRect
« Reply #1 on: May 08, 2009, 12:01:51 pm »
Then just write this function ;)
Code: [Select]
sf::Shape Rectangle(const sf::FloatRect& rect, ...)
{
    return sf::Shape::Rectangle(rect.Left, rect.Top, rect.Right, rect.Bottom, ...);
}
Laurent Gomila - SFML developer

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
sf::Shape::Rectangle that takes a FloatRect
« Reply #2 on: May 08, 2009, 04:45:49 pm »
I thought that as it took 4 coordinates or two vectors it could also take 1 rect.

I know I can create a function to do that, as I can do it adding points to a sf::Shape from scratch.
But that's not the point.

-Martín