SFML community forums
General => Feature requests => Topic started by: Mr. X on October 18, 2008, 07:04:31 pm
-
Hello,
Is it possible to Add a method to the sf::Shape class for drawing an ellipse, or change the circle function, so that it could draw ellipses?
-
Isn't an ellipse just a scaled circle?
-
Yes,
but if I try to scale it, it is just moved by that factor...
-
Yes,
but if I try to scale it, it is just moved by that factor...
Use setCenter to center in the circle center before scale
-
Hello,
it doesn't work. Also when I center the circle before scaling, it is only moved by this factor.
-
When setting the center of the circle, it's relative to the top left coordinates of the circle, not the whole window. I was trying to figure this out and made the mistake of assuming otherwise, but I was able to figure out, in case anyone else looks at this thread in the future and wonders the same thing.
sf::Shape myEllipse = sf::Shape::Circle(200, 200, 60, sf::Color(255, 0, 0));
myEllipse.SetCenter(30, 30);
myEllipse.SetScale(2, 1);
Instead of writing the SetCenter function like...
myEllipse.SetCenter(230, 230);
Solves the problem for me when scaling the circle.