DEF GDISK X,Y,RADIUS,COL IF RADIUS<1 THEN GPSET X,Y,COL:RETURN '(GCIRCLE draws nothing if the radius is 0) 'get the point on the graphics layer that is closest to the center of the circle VAR PX=MIN(MAX(X,0),512-1) VAR PY=MIN(MAX(Y,0),512-1) 'if the distance from the center of the circle to the closest onscreen point is 'larger than the radius, then the circle is completely offscreen VAR DX=PX-X VAR DY=PY-Y IF DX*DX+DY*DY > RADIUS*RADIUS THEN RETURN 'traditional filled circle code GCIRCLE X,Y,RADIUS,8 'draw circle with a special color GPAINT PX,PY,COL,8 'fill area inside GCIRCLE X,Y,RADIUS,COL 'redraw edge in the correct color, so none of the special color is left on screen ENDGPAINT x, y, fill_color, border_color will flood fill all pixels that aren't border_color. This will work even there other things on the GRP, as long as you don't use that special color. I chose 8 (that is, alpha: 0, red: 0, green: 0, blue: 8). There's no reason to ever use this color anywhere else (since it looks identical to color 0), and it should be safe. This is much faster than filling the circle manually using GLINE/GFILL/GTRI/etc.
Even More Perfectly Filled Circles
Root / Submissions / [.]
12Me21Created:
Filled Circle Battle Royale:
- https://smilebasicsource.com/page?pid=803 (Simeon, 2017)
- https://smilebasicsource.com/page?pid=1050 (answer, 2018)
- https://smilebasicsource.com/page?pid=1051 (Simeon, 2018)
- https://smilebasicsource.com/page?pid=1303 (12Me21, 2019)
- https://smilebasicsource.com/page?pid=1460 (Heredos, 2019)
Replying to:Yolkai
Filled Circle Battle Royale:
- https://smilebasicsource.com/page?pid=803 (Simeon, 2017)
- https://smilebasicsource.com/page?pid=1050 (answer, 2018)
- https://smilebasicsource.com/page?pid=1051 (Simeon, 2018)
- https://smilebasicsource.com/page?pid=1303 (12Me21, 2019)
- https://smilebasicsource.com/page?pid=1460 (Heredos, 2019)
trying to figure out which one is better . . .
Replying to:Yolkai
Filled Circle Battle Royale:
- https://smilebasicsource.com/page?pid=803 (Simeon, 2017)
- https://smilebasicsource.com/page?pid=1050 (answer, 2018)
- https://smilebasicsource.com/page?pid=1051 (Simeon, 2018)
- https://smilebasicsource.com/page?pid=1303 (12Me21, 2019)
- https://smilebasicsource.com/page?pid=1460 (Heredos, 2019)
AND...
https://smilebasicsource.com/page?pid=???? (ralsei, 2020)
MEGA MAN 10
PRESS START
uh fuck wrong title screen
SMILE BASIC SOURCE
PRESS DIRECT
Replying to:Yolkai
Filled Circle Battle Royale:
- https://smilebasicsource.com/page?pid=803 (Simeon, 2017)
- https://smilebasicsource.com/page?pid=1050 (answer, 2018)
- https://smilebasicsource.com/page?pid=1051 (Simeon, 2018)
- https://smilebasicsource.com/page?pid=1303 (12Me21, 2019)
- https://smilebasicsource.com/page?pid=1460 (Heredos, 2019)
| Author | Speed | Quality | Reliability | Length | |---------+-------+---------+-------------+--------| | answer | ok | bad | good | 143 | | Simeon | good | good | ok | 286 | | 12Me21 | good | good | good | 222 | | Heredos | bad | ok | good | 346 |(Simeon's fails when the radius is less than 1, and uses the wrong values for the GRP width/height, but these are easy to fix)
speed test results
Performance (draws per second, n3DS) 100, 100 100, -1 program 1 10 100 1000 radius=1 10 100 1000 answer 25500 6480 378 16 26441 7163 537 25 simeon 14400 9400 472 63 34980 9856 876 failed? 12Me21 13432 9000 470 63 40234 10279 876 63 heredos 24900 920 12 0 25817 1001 13 0 Program used:M=MILLISEC+1000 WHILE MILLISEC<M C=!C <function> <x>, <y>, <radius>, C*#RED '(heredos's function requires GCOLOR, and simeon's takes an extra color argument) INC I WEND ?I