Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another small filled circe sub (not as fast as fcirc)
#77
Thanks!

Preparing FC3 for my toolbox I ran into a little snag, when r = 0 the SQR bombs so we have to exit if r < 1.
If r < 1 Then Exit Sub or Pset(cx, cy), clr~& and then exit sub

Here is a little demo of FC3 working off Old Moses demo of square filled circle fills:
Code: (Select All)
_Title "FC3 best version yet" ' b+ 2024-08-31
Option _Explicit
Screen _NewImage(1200, 640, 32)
_ScreenMove 50, 40
Dim x%, r
For x% = 0 To 49
    FC3 (x% Mod 10) * 120 + 60, (x% \ 10) * 120 + 60, x% + 10, _RGB32(0, 128, 0, 100)
Next x%
For r = 290 To 35 Step -2
    FC3 600, 320, r, _RGB32(0, 0, 255, 2) ' <<<< show no overlapping lines at equator or else where
Next
Sleep

Sub FC3 (cx, cy, r, clr~&) ' no suffix punctuation use the Global Default Type as Long or Single or Double
    Dim r2, x, y ' for Option _Explicit
    If r < 1 Then Exit Sub
    Line (cx - r, cy)-(cx + r, cy), clr~&, BF
    r2 = r * r
    Do
        y = y + 1
        x = Sqr(r2 - y * y)
        Line (cx - x, cy + y)-(cx + x, cy + y), clr~&, BF
        Line (cx - x, cy - y)-(cx + x, cy - y), clr~&, BF
    Loop Until y = r
End Sub
shows how nice transparency is.

   
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
RE: Another small filled circe sub (not as fast as fcirc) - by bplus - 08-31-2024, 11:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  A Small Game Tutorial (from 2014) SMcNeill 2 999 11-13-2023, 09:11 PM
Last Post: Kernelpanic
  Small exploding image and fade-out effect Dav 18 3,617 09-08-2023, 11:16 PM
Last Post: dbox
  Space Orbs. Small screen saver. Dav 16 3,232 08-27-2023, 07:52 PM
Last Post: grymmjack
  Ball Sub - draws several kind of filled, textured balls (circles) Dav 15 3,564 08-23-2023, 09:31 PM
Last Post: Dav
  Improved my small Gradient Ball drawing SUB Dav 22 5,431 07-13-2023, 05:23 PM
Last Post: Dav

Forum Jump:


Users browsing this thread: 2 Guest(s)