Code : Tout sélectionner
InitSprite()
InitMouse()
InitKeyboard()
;InitSprite3D()
UseJPEGImageDecoder()
ExamineDesktops()
ddw=DesktopWidth(0)
ddh=DesktopHeight(0)
ddw2=1024
ddh2=768
zoomx.f=(ddw-ddw2)/2
zoomy.f=(ddh-ddh2)/2
OpenScreen(ddw,ddh,32,"SPH Demo")
StartDrawing(ScreenOutput())
Box(0,0,92,128,RGB(150,150,150))
StopDrawing()
GrabSprite(0,0,0,92,128)
StartDrawing(ScreenOutput())
Box(0,0,92,384,RGB(150,150,150))
StopDrawing()
GrabSprite(1,0,0,92,384)
Dim points.Point(10)
f0.f=1
f1.f=0
f2.f=3.14159265/5
la:
Dim craquelure1.b(130)
Dim craquelure2.b(130)
For i=0 To 130
craquelure1(i)=Random(14)-7
craquelure2(i)=Random(14)-7
Next
craquelure.f=1
craquelure_actu.f=0
; debut affichage starscrool
Structure pixel
posx.f
posy.f
xx.f
yy.f
centrex.l
centrey.l
rayon.f
couleur.l
EndStructure
NewList pixel.pixel() ; pour pas s'y perdre, vaux mieux donner le meme nom a la structure qu'a la liste
time=0
centrex=ddw2/2
centrey=ddh2/2
angle.f=0
rnd_angle.f=20
rnd_randon=200
vitessex.f=0.02
vitessey.f=0.02
nbb=0
;############
;############
;############
;############
;############
;############
craque=0
craque2=0
presente= 0
Repeat
ExamineKeyboard()
;ClearScreen(RGB(rvb_cls,rvb_cls,rvb_cls))
;If rvb_cls>0
;rvb_cls-8
;EndIf
ClearScreen(0)
;********************************************
If time<900
For i=1 To 20
AddElement(pixel())
pixel()\centrex=centrex
pixel()\centrey=centrey
rayon.f=5+Random(500)
angle=Random(6559)
x = Cos(angle)*rayon
y = Sin(angle)*rayon
pixel()\posx = x
pixel()\posy = y
z=Random(100)+20
pixel()\xx = x/z
pixel()\yy = y/z
pixel()\couleur = 130+Random(Random(10000))
Next
EndIf
;********************************************
time+1
If time> 180 And time<200
u=100
StartDrawing(ScreenOutput())
For i=craque To 127
LineXY(80+craquelure1(i)+zoomx,ddh-i*8+zoomy,80+craquelure1(i+1)+zoomx,ddh-i*8-8+zoomy,RGB(u,u,u))
u-1
Next
craque+8
StopDrawing()
EndIf
If time> 200 And time<220
u=100
StartDrawing(ScreenOutput())
For i=craque2 To 127
LineXY(350+craquelure2(i)+zoomx,ddh-i*8+zoomy,350+craquelure2(i+1)+zoomx,ddh-i*8-8+zoomy,RGB(u,u,u))
u-1
Next
craque2+8
StopDrawing()
EndIf
;############################################################################
;############################################################################
;############################################################################
;############################################################################
;############################################################################
;############################################################################
;############################################################################
;############################################################################
;############################################################################
If time>220
If craquelure_actu<1500
;
hdc=StartDrawing(ScreenOutput()) ;*********************** S T A R T
craquelure_actu=craquelure
;LineXY(590,0,100,100,RGB(255,255,255))
;
For i=0 To 127
points(0)\x=80+craquelure1(i)+zoomx
points(0)\y=ddh-i*8
points(1)\x=350+craquelure2(i)+zoomx
points(1)\y=ddh-i*8
points(2)\x=350+craquelure1(i+1)+zoomx
points(2)\y=ddh-i*8-8
points(3)\x=80+craquelure2(i+1)+zoomx
points(3)\y=ddh-i*8-8
If hdc
rvb=craquelure_actu*2
If rvb>255
rvb=255
EndIf
Box(0,0,0,0,RGB(rvb/5,rvb/5,rvb))
Polygon_(hdc,points(),4)
EndIf
craquelure_actu*1.01
Next
StopDrawing()
DisplaySprite(0,170+zoomx,70)
hdc=StartDrawing(ScreenOutput()) ;*********************** S T A R T
craquelure_actu=craquelure
For i=0 To 129
points(0)\x=72+craquelure1(i)+zoomx-craquelure_actu/2
points(0)\y=ddh-i*8+craquelure_actu
points(1)\x=358+craquelure2(i)+zoomx+craquelure_actu/2
points(1)\y=ddh-i*8+craquelure_actu
points(2)\x=358+craquelure1(i+1)+zoomx+craquelure_actu/2
points(2)\y=ddh-i*8-8+craquelure_actu*1.015
points(3)\x=72+craquelure2(i+1)+zoomx-craquelure_actu/2
points(3)\y=ddh-i*8-8+craquelure_actu*1.015
rvb=craquelure_actu*2
If rvb>255
rvb=255
EndIf
If points(1)\y>points(2)\y
Box(0,0,0,0,RGB(rvb/4,rvb/3,rvb/2))
Else
Box(0,0,0,0,RGB(rvb,rvb,rvb))
EndIf
If hdc
If points(1)\y<1100
Polygon_(hdc,points(),4)
EndIf
EndIf
craquelure_actu*1.015
Next
craquelure*1.025
StopDrawing()
Else ; les polygones bleus qui restent
hdc=StartDrawing(ScreenOutput()) ;*********************** S T A R T
;LineXY(590,0,500,100,RGB(255,255,255))
If presente>560
If reduc.f=0
reduc.f=1.1
EndIf
For i=0 To 127
points(0)\x=80+zoomx+craquelure1(i)-reduc/20
points(0)\y=ddh-i*8
points(1)\x=350+zoomx+craquelure2(i)+reduc/7
points(1)\y=ddh-i*8
points(2)\x=350+zoomx+craquelure1(i+1)+reduc/7
points(2)\y=ddh-i*8-8
points(3)\x=80+zoomx+craquelure2(i+1)-reduc/20
points(3)\y=ddh-i*8-8
If hdc
Box(0,0,0,0,RGB(51,51,255))
Polygon_(hdc,points(),4)
EndIf
Next
reduc*1.035
Else ; ca disparait ou c'est fixe
For i=0 To 127
points(0)\x=80+zoomx+craquelure1(i)
points(0)\y=ddh-i*8
points(1)\x=350+zoomx+craquelure2(i)
points(1)\y=ddh-i*8
points(2)\x=350+zoomx+craquelure1(i+1)
points(2)\y=ddh-i*8-8
points(3)\x=80+zoomx+craquelure2(i+1)
points(3)\y=ddh-i*8-8
If hdc
Box(0,0,0,0,RGB(51,51,255))
Polygon_(hdc,points(),4)
EndIf
Next
EndIf
StopDrawing()
presente+1
If presente>=50
If presente<120
DisplaySprite(1,170+zoomx,280)
; 140,340 to 290,990
StartDrawing(ScreenOutput())
For i=140 To 990 Step 50
Circle(180+zoomx,i-25,120-presente,RGB(51,51,255))
Circle(250+zoomx,i+25,120-presente,RGB(51,51,255))
Next
;LineXY(0,0,100,100,RGB(255,0,0))
StopDrawing()
;Else
;Displaysprite(1,170,280)
EndIf
EndIf
; fin d'un long process
If presente<660
DisplaySprite(0,170+zoomx,70)
EndIf
EndIf
EndIf
If time<1040
nbb+1
If time>500
;bspline(0,0,200,0,200,200,0,200,RGB(255,180,150),hdc)
vitessex+0.00005
vitessey+0.00002
EndIf
hdc=StartDrawing(ScreenOutput()) ;*********************** S T A R T
;LineXY(30,0,100,100,RGB(255,255,0))
;********** A partir d'ici, tout est "LinkedList"
ForEach pixel.pixel() ; tant qu'il y a des etoiles on les affiches
With pixel()
x=\centrex+\posx+\xx+Cos(nbb/1000)*Cos(nbb/100)*nbb/2
y=\centrey+\posy+\yy+Sin(nbb/100)*Cos(nbb/100)*nbb/2
\xx*(1+vitessex*2)
\yy*(1+vitessey*2)
If x>ddw-2 Or x<1 Or y>ddh-2 Or y<1
DeleteElement(pixel()) ; on la tue
Else ; sinon
\couleur*(1+vitessex)
If \couleur>65535
\couleur=65535
EndIf
If \couleur<32768
rvb=\couleur/129
Plot(x,y,RGB(rvb,rvb,rvb)) ; on l'affiche
Else
Plot(x,y,RGB(255,255,255)) ; on l'affiche
rvb=(\couleur-32768)/130
Plot(x+1,y,RGB(rvb,rvb,rvb)) ; on l'affiche
Plot(x-1,y,RGB(rvb,rvb,rvb)) ; on l'affiche
Plot(x,y+1,RGB(rvb,rvb,rvb)) ; on l'affiche
Plot(x,y-1,RGB(rvb,rvb,rvb)) ; on l'affiche
rvb/2
Plot(x+1,y+1,RGB(rvb,rvb,rvb)) ; on l'affiche
Plot(x-1,y-1,RGB(rvb,rvb,rvb)) ; on l'affiche
Plot(x-1,y+1,RGB(rvb,rvb,rvb)) ; on l'affiche
Plot(x+1,y-1,RGB(rvb,rvb,rvb)) ; on l'affiche
EndIf
EndIf
EndWith
Next ; ce "foreach:next" s'addapte donc toujours au vrai nombre d'etoiles
;********** fin de la technique "LinkedList"
;DrawText(50,50,Str(time),RGB(255,50,50),0)
;DrawText(50,100,Str(presente),RGB(255,50,50),0)
;DrawText(50,150,Str(vitessex),RGB(255,50,50),0)
StopDrawing()
If presente>=120 And presente<400
If presente>=350
DisplaySprite(1,170+zoomx,280+(presente-350)*32)
Else
DisplaySprite(1,170+zoomx,280)
EndIf
EndIf
EndIf
If presente>=500 And presente<815 ; etoile qui fait disparaitre sph
If presente=500
Dim points.Point(10)
gro.f=0
f0.f=1.00001
f1.f=1
f2.f=3.14159265/5
EndIf
points(0)\x=216+zoomx+Cos(f1)*Sin(gro)*250
points(0)\y=154+Sin(f1)*Sin(gro)*250
f1+f2
points(1)\x=216+zoomx+Cos(f1)*Sin(gro)*130
points(1)\y=154+Sin(f1)*Sin(gro)*130
f1+f2
points(2)\x=216+zoomx+Cos(f1)*Sin(gro)*250
points(2)\y=154+Sin(f1)*Sin(gro)*250
f1+f2
points(3)\x=216+zoomx+Cos(f1)*Sin(gro)*130
points(3)\y=154+Sin(f1)*Sin(gro)*130
f1+f2
points(4)\x=216+zoomx+Cos(f1)*Sin(gro)*250
points(4)\y=154+Sin(f1)*Sin(gro)*250
f1+f2
points(5)\x=216+zoomx+Cos(f1)*Sin(gro)*130
points(5)\y=154+Sin(f1)*Sin(gro)*130
f1+f2
points(6)\x=216+zoomx+Cos(f1)*Sin(gro)*250
points(6)\y=154+Sin(f1)*Sin(gro)*250
f1+f2
points(7)\x=216+zoomx+Cos(f1)*Sin(gro)*130
points(7)\y=154+Sin(f1)*Sin(gro)*130
f1+f2
points(8)\x=216+zoomx+Cos(f1)*Sin(gro)*250
points(8)\y=154+Sin(f1)*Sin(gro)*250
f1+f2
points(9)\x=216+zoomx+Cos(f1)*Sin(gro)*130
points(9)\y=154+Sin(f1)*Sin(gro)*130
f1+f2
f1+f0-1
f0*1.0003
gro+0.01
hdc=StartDrawing(ScreenOutput())
;DrawingMode(#PB_2DDrawing_XOr)
;LineXY(60,0,100,100,RGB(255,0,255))
If hdc
Box(0,0,0,0,RGB(255,255,220))
Polygon_(hdc,points(),10)
EndIf
StopDrawing()
EndIf ; fin de l'etoile qui fait disparaitre sph
FlipBuffers()
; fin starscrool ********************************************
If time>1255
end
EndIf
Until KeyboardPushed(#PB_Key_Escape)