Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filled and width parameters to draw_circle #7761

Closed
mieldepoche opened this issue Sep 20, 2023 · 2 comments · Fixed by godotengine/godot#84472
Closed

Add filled and width parameters to draw_circle #7761

mieldepoche opened this issue Sep 20, 2023 · 2 comments · Fixed by godotengine/godot#84472
Milestone

Comments

@mieldepoche
Copy link

Describe the project you are working on

stuff

Describe the problem or limitation you are having in your project

  • draw_rect has a filled parameter and a width parameter for the cases where you want to draw a non-filled rect.
  • draw_circle doesn't have that, forcing you to use draw_arc with a big angle whenever you want an unfilled circle (and forcing you to discover it in the first place).

btw, a filled circle is a disk, so draw_circle doesn't technically draw circles.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add the fitting parameters and functionality to draw_circle. It would feel natural to me. Having this as a parameter allows to quickly switch between the filled and unfilled versions when needed, without the need to rewrite the line.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

draw_circle(position: Vector2, radius: float, color: Color, filled := true, width := -1.0)
The parameter order would be the same as draw_rect for consistency.
Behavior should be the same too:

  • if filled == true, the current behavior remains
  • if filled == false, then a circle of with width is drawn. I think width == -1.0 means 1 screen pixel.

I guess internally it could simply branch to draw_arc with an automatic point count, but that's the naive way. I don't know if it's easy to make it draw an actual circle, and what performance difference there is with a filled one.

If this enhancement will not be used often, can it be worked around with a few lines of script?

it can be worked around with draw_arc, but it's more verbose and harder to find. It also has a point_count, so no true circles.

Is there a reason why this should be core and not an add-on in the asset library?

it's about improving core

@AThousandShips
Copy link
Member

Note that draw_arc and draw_circle work very differently internally

@Calinou
Copy link
Member

Calinou commented Sep 20, 2023

If a width parameter is implemented, then antialiased should also be added to match draw_line().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants