Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.82k stars 821 forks source link

Feature request: Add numSides extra parameter in Canvas::drawCircle & Canvas::drawEllipse #1068

Closed Adolio closed 4 years ago

Adolio commented 4 years ago

Hi Daniel,

It would be nice to have an extra parameter in Canvas::drawCircle method to specify the number of sides as the Polygon does already. The same could be applied to the Canvas::drawEllipse method as well.

Methods would then look like this:

/** Draws a circle. */
public function drawCircle(x:Number, y:Number, radius:Number, numSides:int = -1):void
{
    appendPolygon(Polygon.createCircle(x, y, radius, numSides));
}

/** Draws an ellipse. */
public function drawEllipse(x:Number, y:Number, width:Number, height:Number, numSides:int = -1):void
{
    var radiusX:Number = width  / 2.0;
    var radiusY:Number = height / 2.0;

    appendPolygon(Polygon.createEllipse(x + radiusX, y + radiusY, radiusX, radiusY, numSides));
}

What do you think?

Best, Aurélien

PrimaryFeather commented 4 years ago

You're perfectly right, Aurélien. It makes sense to have this parameter exposed – just in case.

Adolio commented 4 years ago

Thanks Daniel 😀