PDA

View Full Version : Lawn



peter
25-02-2014, 20:51
Hi,

your own lawn.


Uses "ui"
#INCLUDE "gdip.inc"

OpenWindow 300, 300
Randomize

Single kt, idx, idy, wx, wy, jy, jx, tx, ty, r, y, x, k, c
Single m, xmin, xmax, ymin, ymax
kt=50 : m =4.0 : xmin =2.1 : xmax =-0.6 : ymin =-1.5 : ymax =1.5
idx =(xmax - xmin)/320
idy =(ymax - ymin)/320

SetSmoothMode 2
ClsColor Argb(255,0,200,0)
For x=0 To 310
jx = xmin + x*idx
For y =0 To 350
jy = ymin + y*idy
k =0
wx=0
wy=0
While iswindow(hwnd)
If r <= m And k < kt Then
tx = wx*wx - wy*wy + jx
ty = 2*wx * wy + jy
wx = tx
wy = ty
r = wx*wx + wy*wy
k = k + 1
Else
Exit While
End If
Wend
DrawEllipse x,y,15,15,1, ARGB(255,0,Rnd(24,255),0)
Next
Canvas_Redraw
Next

While IsWindow(hwnd) And GetAsyncKeyState(27)=0
Sleep 10
Wend
Canvas_Window End hwnd

John Spikowski
25-02-2014, 23:16
Hi Peter,

When I tried your code it never exits the WHILE/WEND loop.


John

peter
26-02-2014, 00:38
Hi John,

No, does work, at least here.
I have altered the "While (1)" loop.

John Spikowski
26-02-2014, 03:12
I got by the WHILE/WHEN issue but not sure what I'm suppose to be seeing. Can you post a screen shot of what it looks like there?

peter
26-02-2014, 11:47
Green Lawn :D