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

Author Topic: Why was sf::Shape split up?  (Read 1490 times)

0 Members and 1 Guest are viewing this topic.

Marcus

  • Newbie
  • *
  • Posts: 7
    • View Profile
Why was sf::Shape split up?
« on: April 08, 2012, 07:18:22 am »
I was wondering why sf::Shape was split up from SFML 1.6 to SFML 2. I tried to convert my nice static base class to SFML2 only to find out sf::Shape were split up into sf::RectangleShape, sf::CircleShape, etc. making it impossible/unclean to have my baseclass control the derived.

I'm also wondering why the simple Line shape was phased out in favor of vertex arrays.

At least have a way of converting between the types to simplify drawing. Now I have to move all my base functions into the derived classes, destroying the point of having clean derived classes.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Why was sf::Shape split up?
« Reply #1 on: April 08, 2012, 08:28:55 am »
Quote
I was wondering why sf::Shape was split up from SFML 1.6 to SFML 2
To solve issues that people were having:
- they thought Shape::Rectangle, Shape::Circle, etc. were "types" or "constructors"
- the parameters of these functions were misunderstood (for example, they mixed global color and points' color)
- they complained about not being able to change the radius/size/whatever of a shape after constructing it
- new features (texture, texture rect) wouldn't fit in the old design (construction functions already took too many arguments)

Quote
I'm also wondering why the simple Line shape was phased out in favor of vertex arrays.
1-pixel lines can be reproduced with 2 vertices drawn as sf::Lines.
Lines with thickness are just rotated rectangles.
So there's actually no need for a sf::LineShape class.
Laurent Gomila - SFML developer