Post by matthew on Nov 11, 2006 22:20:14 GMT -5
This programme had been on my hard disk drive written in another version of Basic for about a year.
I discovered it on a different forum but never got around to converting it to Brutus2D.
I discovered it on a different forum but never got around to converting it to Brutus2D.
OPTION Explicit
DIM AppRun : AppRun = TRUE
DIM Cx, Cy
DIM Scale
DIM Limit
DIM Lp
DIM A1, B1, A2, B2
DIM X, Y
DIM Ax, Ay
DIM Width, Height
DIM PxFocus
DIM R, G, B
DIM LpLimit
PxFocus = 16
Width = 640 : Height = 480
Cx = -0.5 : Cy = 0.0
Scale = 0.004
Limit = 4.0
LpLimit = 125
Width = Width / PxFocus
Height = Height / PxFocus
Scale = Scale * PxFocus
SUB Main()
IF (Graphics.Initialize <> TRUE) THEN EXIT SUB
Graphics.SetTitle "Fast Draw Fractal"
Key.Initialize
Graphics.Clear &h000000
While PxFocus >= 1 And AppRun = TRUE
For X = 0 to Width
For Y = 0 to Height
Ax = Cx + ((X - (Width / 2)) * Scale)
Ay = Cy + ((Y - (Height / 2)) * Scale)
A1 = Ax
B1 = Ay
Lp = 0
While ((A1 * A1) + (B1 * B1)) < Limit And Lp < LpLimit And AppRun = TRUE
Lp = Lp + 1
A2 = (A1 * A1) - (B1 * B1) + Ax
B2 = (2 * A1 * B1) + Ay
A1 = A2
B1 = B2
wend
R = (255 / (LpLimit / 4)) * Lp
G = (255 / (LpLimit / 2)) * Lp
B = (255 / LpLimit) * Lp
If Lp > (LpLimit - 1) then
R = 0
G = 0
B = 0
End If
Graphics.SetRect X * PxFocus, Y * PxFocus, PxFocus, PxFocus, ARGB(255, R, G, B)
Graphics.Display
Next
IF Key.Pressed(1) Or Key.Pressed(0) = TRUE THEN
AppRun = FALSE
Exit For
End if
System.ProcessMessages
Next
Width = Width * 2
Height = Height * 2
Scale = Scale / 2
PxFocus = PxFocus / 2
wend
Do While AppRun = TRUE
IF Key.Pressed(1) Or Key.Pressed(0) = TRUE THEN AppRun = FALSE
System.ProcessMessages
Loop
Graphics.Terminate
Key.Terminate
End SUB
CALL Main