Personally I think it is a fly by night idea.
Stationary in it's track.
A road to nowhere.
A lonely place.
No, that means loading everything, which is not wanted.
Code: Select all
#define gfx
#define std
sub bird
dim as integer xres,yres
gfx.screeninfo xres,yres
dim as double PLOT_grade=2000
dim as double temp1,temp2
#macro sketch(_function,minx,maxx,miny,maxy)
For x As Double=minx To maxx Step (maxx-minx)/PLOT_GRADE
dim as double x1=(xres)*(x-minx)/(maxx-minx)
dim as double y1=(yres)*(_function-maxy)/(miny-maxy)
gfx.Pset(x1,y1),rgb(0,0,10)
if abs(x)<1e-3 then
temp1=x1:temp2=y1
end if
Next x
gfx.circle (temp1,temp2),50,rgb(0,200,0),,,,f
gfx.circle (temp1-20,temp2-20),10,rgb(200,200,200),,,,f
gfx.circle (temp1+20,temp2-20),10,rgb(200,200,200),,,,f
gfx.circle (temp1-20-5*z,temp2-20),3,rgb(00,00,200),,,,f
gfx.circle (temp1+20-5*z,temp2-20),3,rgb(00,00,200),,,,f
gfx.circle (temp1,temp2),30,rgb(0,0,0),4,5.5
gfx.circle (temp1,temp2-2),30,rgb(0,0,0),4-k/3,5.5+k/3
gfx.circle (temp1,temp2),51,rgb(0,0,10)
#endmacro
static k as integer=1
static z as double
dim pi as double=4*std.atn(1)
z=z+.02*k
sketch (-std.sin(z*x+z),-(pi),pi,-2,2)
sketch (std.sin(z*x-z),-(pi),pi,-2,2)
gfx.paint (.25*xres,.5*yres),rgb(0,50,120),rgb(0,0,10)
gfx.paint (.75*xres,.5*yres),rgb(0,50,120),rgb(0,0,10)
if z>1.1 then k=-k
if z<-1.1 then k=-k
if z>2*pi then z=0
gfx.window screen (0,0)-(xres,yres)
end sub
Sub Tree(x1 As Single,y1 As Single,size As Single,angle As Single,depth As Single,colb As ulong=0,colL As ulong=0,im as any ptr=0)
Dim As Single spread,scale,x2,y2
spread=25
scale=.76
#define incircle(cx,cy,radius,x,y) (cx-x)*(cx-x) +(cy-y)*(cy-y)<= radius*radius
x2=x1-.25*size*std.Cos(angle*.01745329)
y2=y1-.25*size*std.Sin(angle*.01745329)
Static As long count,fx,fy,sz,z
If count=0 Then fx=x1:fy=y1:sz=size:z=2^(depth+1)-1
gfx.Line im,(x1,y1)-(x2,y2),colb
If count=0 Then fx=x2:fy=y2:sz=size
count=count+1
If count>z Then count=0
If incircle(fx,fy,(.45*sz),x2,y2)=0 Then gfx.Circle im,(x2,y2),.01*sz,colL
If depth>0 Then
Tree(x2, y2, size * Scale, angle - Spread, depth - 1,colB,colL,im)
Tree(x2, y2, size * Scale, angle + Spread, depth - 1,colB,colL,im)
End If
End Sub
Function Regulate(Byval MyFps As long,Byref fps As long=0) As long
Static As Double timervalue,lastsleeptime,t3,frames
Var t=std.Timer
frames+=1
If (t-t3)>=1 Then t3=t:fps=frames:frames=0
Var sleeptime=lastsleeptime+((1/myfps)-T+timervalue)*1000
If sleeptime<1 Then sleeptime=1
lastsleeptime=sleeptime
timervalue=T
Return sleeptime
End Function
gfx.screenres 1024,768,32
gfx.color , rgb(0,0,20)
dim as any ptr i=gfx.imagecreate(1024,768)
gfx.paint i,(0,0),rgb(0,0,35)
gfx.line i,(0,500)-(1024,768),rgb(0,30,0),bf
for n as long=1 to 200
gfx.pset i,(rnd*1024,rnd*500)
next
gfx.line i,(200,768)-(800,500),rgb(30,30,30)
gfx.line i,(850,500)-(900,768),rgb(30,30,30)
gfx.line i,(800,500)-(850,500),rgb(30,30,30)
gfx.paint i,(250,750),rgb(30,30,30),rgb(30,30,30)
var L=std.sqr((825-550)^2 + (768-500)^2)
var dx=(825-550)/L,dy=(768-500)/L
var x=0,y=0
gfx.pset(550,768)
dim as ulong clr
dim as single k=10,g=20
for n as long=1 to 50
if n and 1 then clr=rgb(100,100,100) else clr=rgb(30,39,30)
var x=550+dx*g*n,y=768-dy*g*n
gfx.line i,-(x+dx*k,y-dy*k),clr
g=.98*g
next
for n as long=1 to 8
Tree(-50+std.sqr(9-n)*280,500+n*20,n*40+std.rnd*20,90+(std.rnd*10-std.rnd*20),12,rgb(100,std.rnd*155,0),rgb(0,100,0),i)
next
do
gfx.screenlock
gfx.cls
gfx.put(0,0),i,trans
bird
gfx.screenunlock
std.sleep regulate(50),1
loop until std.len(std.inkey)
std.sleep
gfx.imagedestroy(i)