TGC Codebase Backup



Fast Circle Fill Function by Mortus

5th Jan 2008 16:09
Summary

Draws any filled in circle that fits on screen perfectly and fills it in solid. also has a color option and soon a gradient color fill.



Description

Draws any filled in circle that fits on screen perfectly and fills it in solid. also has a color option and soon a gradient color fill.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    sync on

Do
   FillCircle(320,240,500,RGB(255,0,0))
   ink Rgb(255,255,255),0
   text 10,10,Str$(Screen FPS())
   Sync
   Cls
Loop

Function FillCircle(X#,Y#,R#,C)
   Ink C,0
   Step# = 0.5
   TempR# = R#
   Loops = 0
   While TempR# > 114 and Loops < 5
      Loops = Loops + 1
      Step# = Step# / 2
      TempR# = TempR# - 115
   Endwhile
   For A# = 1 to 180 Step Step#
      Line X#+(Cos(A#+90)*R#),Y#+(Sin(A#+90)*R#),X#+(Cos((0-A#)+90)*R#),Y#+(Sin((0-A#)+90)*R#)
   Next A#
Endfunction