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)
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.