Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plasma Snake
#6
(06-27-2023, 06:33 PM)dbox Wrote:
(06-27-2023, 05:39 PM)bplus Wrote: @dbox did you have to change anything? Maybe dim stuff?
I added the Dim on line 13, a _Limit 60 on line 44 and then I made the FCirc conditionally run the QBJS filled circle method.  This last step wasn't absolutely necessary, but it performs better in the browser to use the native fill circle function.

Ah I caught the dims and the FCirc, I should change my QB64 FCirc sub?

Yes! still works fine in QB64:
Code: (Select All)
Sub FCirc (CX As Long, CY As Long, R As Long, C As _Unsigned Long)
    $If WEB Then
            G2D.FillCircle CX, CY, R, C
    $Else
        Dim Radius As Long, RadiusError As Long
        Dim X As Long, Y As Long
        Radius = Abs(R): RadiusError = -Radius: X = Radius: Y = 0
        If Radius = 0 Then PSet (CX, CY), C: Exit Sub
        Line (CX - X, CY)-(CX + X, CY), C, BF
        While X > Y
            RadiusError = RadiusError + Y * 2 + 1
            If RadiusError >= 0 Then
                If X <> Y + 1 Then
                    Line (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
                    Line (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
                End If
                X = X - 1
                RadiusError = RadiusError - X * 2
            End If
            Y = Y + 1
            Line (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
            Line (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
        Wend
    $End If
End Sub

I should change my other ones like that too.

Missed the _Limit (posted in some other forums we both are at), I was surprised how the circle drawing was taking so much time that I didn't need _Limit but apparently QBJS through JS can kick butt with circle fills!
b = b + ...
Reply


Messages In This Thread
Plasma Snake - by bplus - 06-27-2023, 03:14 PM
RE: Plasma Snake - by dbox - 06-27-2023, 04:28 PM
RE: Plasma Snake - by bplus - 06-27-2023, 05:39 PM
RE: Plasma Snake - by dbox - 06-27-2023, 06:33 PM
RE: Plasma Snake - by bplus - 06-27-2023, 07:00 PM
RE: Plasma Snake - by mnrvovrfc - 06-27-2023, 05:28 PM
RE: Plasma Snake - by bplus - 06-27-2023, 07:11 PM



Users browsing this thread: 1 Guest(s)