
Code : Tout sélectionner
; Codé par SPH(2006) sur PB4
InitSprite()
InitMouse()
InitKeyboard()
Procedure Ligne(x1.f,y1.f,x2.f,y2.f,Couleur.l)
Shared dx.f,dy.f,xincr.l,yincr.l,x.l,y.l,erreur.f
If x1<>0 And y1<>0 And x2<>0 And y2<>0
;/* On initialise nos variables */
dx = Abs(x2-x1)
dy = Abs(y2-y1)
If x1<x2
xincr = 1
Else
xincr = -1
EndIf
If y1<y2
yincr = 1
Else
yincr = -1
EndIf
;/* Trace de ligne */
x = x1
y = y1
If dx>dy
erreur = dx/2 ; /* c'est plus esthetique comme ca */
For i= 0 To dx
x = x+xincr;
erreur = erreur+dy
If erreur > dx
erreur = erreur - dx
y = y+yincr
EndIf
If x>0 And x<DesktopWidth(0) -1 And y>0 And y<DesktopHeight(0) -1
Plot(x,y,Couleur)
EndIf
Next i
Else
erreur = dy/2; /* c'est plus esthetique comme ca */
For i=0 To dy
y = y + yincr
erreur = erreur + dx
If erreur>dy
erreur = erreur - dy
x = x + xincr
EndIf
If x>0 And x<DesktopWidth(0) -1 And y>0 And y<DesktopHeight(0)-1
Plot(x,y,Couleur)
EndIf
Next i
EndIf
EndIf
EndProcedure
SetPriorityClass_ ( GetCurrentProcess_ (), #IDLE_PRIORITY_CLASS )
If ExamineDesktops()
dw.w=DesktopWidth(0)
dh.w=DesktopHeight(0)
Else
dw.w=1024
dh.w=768
EndIf
OpenScreen(dw,dh,32,"")
dw2.w=dw/2
dh2.w=dh/2
dkx.f=0
ff.f=0
ffm.f=ff.f
t0.f=Random(400)/10
tt0.f=0.001+Random(400)/1000000
t1.f=Random(400)/10
tt1.f=0.001+Random(400)/1000000
t2.f=Random(400)/10
tt2.f=0.001+Random(400)/1000000
t3.f=Random(400)/10
tt3.f=0.001+Random(400)/1000000
ra0=dw2/4
ra1=dh2/4
t01.f=t0.f
t11.f=t1.f
t21.f=t2.f
t31.f=t3.f
Repeat
ExamineMouse()
xmouse2=MouseDeltaX()/25
ymouse2=MouseDeltaY()/25
;******************************************************* affichage
ClearScreen(0)
StartDrawing(ScreenOutput())
x1=dw2
y1=dh2
r.f=70
rr.f=0.000002
cmb=500
For i=1 To 255
rvb=RGB(i+i,i/2,i)
For u=0 To cmb
x2=dw2+Cos(t0)*ra0+Cos(t2)*ra0+Cos(ff)*r
y2=dh2+Sin(t1)*ra1+Sin(t3)*ra1+Sin(ff)*r
Ligne(x1,y1,x2,y2,rvb)
;LineXY(x1,y1,x2,y2,rvb)
;Line(x1,y1,1,1,rvb)
ff+0.91
rr*1.000001
r+rr
t0+tt0
t1+tt1
t2+tt2
t3+tt3
x1=dw2+Cos(t0)*ra0+Cos(t2)*ra0+Cos(ff)*r
y1=dh2+Sin(t1)*ra1+Sin(t3)*ra1+Sin(ff)*r
;LineXY(x1,y1,x2,y2,rvb)
ff+0.1
rr*1.001
r+rr
t0+tt0
t1+tt1
t2+tt2
t3+tt3
Next
If cmb>10
cmb-26
EndIf
Next
StopDrawing()
FlipBuffers(1)
;******************************************************* fin affichage
ff=ffm+1
ffm+0.03
t01+0.03
t11+0.04
t21+0.023
t31+0.032
t0=t01
t1=t11
t2=t21
t3=t31
ExamineKeyboard()
Until xmouse<>xmouse2 Or ymouse<>ymouse2 Or KeyboardPushed(#PB_Key_All)
End