Publié : jeu. 27/mai/2004 21:17
c'était pas moi mais le chat 

Dim ysprite(1000)
Dim de(1000)
Dim nom$(12)
Dim liste(1000)
Dim index(1000)
Dim y(1000)
sprite=1
#Police=1
;*********** pour le screensaver
Param.s = Left(ProgramParameter(), 2)
If Param = "/p"
End
EndIf
GetCursorPos_(SourisOrigine.POINT)
ShowCursor_(0)
; ***********************************
Resultat = InitSprite()
FontID = LoadFont(#Police, "arial", 18, #PB_Font_Bold )
EcranX = GetSystemMetrics_(#SM_CXSCREEN)
EcranY = GetSystemMetrics_(#SM_CYSCREEN)
;NbSprite = EcranX / 40 * 3
NbSprite =12
OpenWindow(1, 0, 0, EcranX, EcranY, #PB_Window_BorderLess | #PB_Window_Invisible, "Matrix")
SetWindowPos_(WindowID(), -1, 0, 0, 0, 0, #SWP_NOSIZE | #SWP_NOMOVE) ; fenêtre toujours au premier plan
OpenWindowedScreen(WindowID(), 0, 0, EcranX, EcranY, 1, 0, 0)
nom$(1)="F,r,e,d, ,P,o,l,u,x, ,A,r,t,e,m,i,s, ,c,o,m,t,o,i,s, ,y,u,k,i,n, ,P,a,t,r,i,c,k,8,8, ,O,l,i,v, ,V,y,c, ,K,e,p,h, ,h,a,c,k,o,t,e,d,e,l,a,p,l,a,q,u,e, ,C,i,n,d,e,r,e,l,l,a, ,f,i,l,p,e,r,j, ,M,a,c,R,a,i,n,*,"
nom$(2)="B,e,r,n,a,r,d, ,D,e,n,i,s, ,S,n,o,o,z,e, ,M,a,r,c,u,s, ,D,r,., ,D,r,i, ,T,€,r,$,@,k,€,n, ,m,e,l,y,s,o,p,h, ,P,i,e,r,r,e, ,A,r,a,n,o,t,h, ,O,m,b,r,e,s, ,C,h,r,i,s,*,"
nom$(3)="g,a,u,t, ,l,e,o,n,e,o, ,L,u,k,k,y, ,v,i,r,t,u,a,l,y,s, ,P,a,n,e,r,i,c, ,h,t,e,a,m,s,p,y, ,D,E,F, ,b,r,o,s,s,d,e,n, ,-,-,-,f,r,e,d,-,-,-, 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,_,p,u,r,e, ,g,i,l,l,e,s, ,r,o,b,e,r,t, ,C,A,R,T,E,R, ,P,a,t,r,i,c,k, ,c,h,r,o,n,o,m,a,n,c,i,e,n,*,"
nom$(10)="j,b,e,r,n,a,r,d,1,3, ,b,l,u,e, ,M,i,c,k,e,y, ,G,o,o,d,0,7, ,R,e,m,y,X, ,t,i,t,i,m,o,b,y, ,H,e,e,r,o, ,C,r,e,e,p,y, ,j,b,l,a,i,s,e,.,c,s, ,D,o,m,i,n,i,q,u,e,B, ,b,u,g,r,a,n,e,*,"
nom$(11)="P,i,e,r,r,e, ,t,h,e, ,n,o,o,b, ,o,f, ,o,f, ,b,a,s, ,b,l,a,c,k,r,o,c,k, ,r,Y,n,0, ,L,E,_,B,a,s,s,i,s,t,e,_,A,t,i,t,r,é, , ,N,o,T, ,Y,a,m, ,f,w,e,i,l, ,Y,o,u,r,H,e,a,d,[,^,_,-,],*,"
nom$(12)="G,a,l,e,n, ,L,O,U,L,O,U,2,5, ,m,i,c,k,e, ,c,h,a,r,l,y, ,g,a,r,z,u,l, ,B,l,o,u,t,i,o,u,f, ,D,a,r,k,D,r,a,g,o,n, ,n,e,m,o, ,g,i,l,l,e,s,p,e,y,r,i,n, ,y,a,n,n,6,4, ,D,o,b,r,o,*,"
de= Random(EcranX) :; on tire une colonne au hazard
; on crée un sprite
For spr=1 To 12
Resultat = CreateSprite(spr, 24,24*Len(nom$(spr)),0 )
While index(spr)<=Len(nom$(spr))+1
index(spr)=index(spr)+1
car$ = StringField(nom$(spr), index(spr), ",")
y(spr)=y(spr)+24:; pour que le text descende
StartDrawing(SpriteOutput(spr))
BackColor(0, 0,0)
c = c *1.4 :; on eclaircie la couleur !!
If c>255:c=0:EndIf
If car$ = " "
c = 10
EndIf ; on remet la couleur d'origine sur les espaces
;c=255
FrontColor(0, c, 0)
Locate(0, y(spr))
DrawingFont(FontID)
DrawText(car$)
StopDrawing()
Wend
Next spr
;***********************************
For ind=1 To 100
ysprite(ind)=0-Random(900)-900:; on tire une ligne de depart au dessus de l'ecran
de(ind)= Random(EcranX)*24
liste(ind)=de(ind)
Next ind
For ind=1 To 12
Next ind
Repeat
RandomSeed(Random(255))
For ind=1 To 50
; si le sprite sort en bas
If ysprite(ind)>EcranY
ysprite(ind)=-Random(1900)-900:; on tire une ligne de depart au dessus de l'ecran
de(ind)= Random(EcranX)+27 :; on tire une colonne au hazard (on en profite)
EndIf
spr=spr+1
If spr>12
spr=1
EndIf
ysprite(ind)=ysprite(ind)+Random(7)+5
DisplayTransparentSprite(spr, de(ind), ysprite(ind))
Next ind
FlipBuffers()
ClearScreen(0,0,0)
GetCursorPos_(Souris.POINT)
Until WindowEvent() = #PB_Event_CloseWindow Or Souris\x <> SourisOrigine\x Or Souris\y <> SourisOrigine\y
ShowCursor_(1)
cette portion de code determine la couleur de depart et celle d'arrivé (Merci CEDERAVICK !c = c *1.4 :; on eclaircie la couleur !!
If c>255:c=0:EndIf
If car$ = " "
c = 10
ça represente le pas d'eclaircissement !c = c *1.4
ça forcera les lettre a la couleur verte !!;c=255
Pour le StringField, j'avais pas vu: Puis c'était juste une question comme ça.Dobro a écrit :cherche pas trop la petite bete , car comme je l'ai deja dit sur ce forum
je program basic a l'ancienne ,et les structure et autre liste chainée sont du chinois pour moi !
et pis j'ai pas cherché l'optimisation !
Code : Tout sélectionner
; Matrix Cree Par Dobro
Dim ysprite(1000)
Dim de(1000)
Dim nom$(30)
Dim liste(1000)
Dim index(1000)
Dim y(1000)
sprite=1
#Police=1
;===========constante son========
Enumeration
#son_1
EndEnumeration
;================================
;*********** pour le screensaver
Param.s = Left(ProgramParameter(), 2)
If Param = "/p"
End
EndIf
GetCursorPos_(SourisOrigine.POINT)
ShowCursor_(0)
; ***********************************
Resultat = InitSprite()
FontID = LoadFont(#Police, "arial", 18, #PB_Font_Bold )
EcranX = GetSystemMetrics_(#SM_CXSCREEN)
EcranY = GetSystemMetrics_(#SM_CYSCREEN)
;NbSprite = EcranX / 40 * 3
NbSprite =12
;===initialisation et chargement du son=============
Result = InitSound()
son1.s ="C:\Mes documents\Ma musique\Mes mix\mix0002.wav" ;choisir un wav qui vous plaît
If LoadSound(#son_1,son1)
PlaySound(#son_1,1);O si vous voulez l'entendre qu'une fois, 1 pour l'écoute en continu.
EndIf
;======c'est tout============
OpenWindow(1, 0, 0, EcranX, EcranY, #PB_Window_BorderLess | #PB_Window_Invisible, "Matrix")
SetWindowPos_(WindowID(), -1, 0, 0, 0, 0, #SWP_NOSIZE | #SWP_NOMOVE) ; fenêtre toujours au premier plan
OpenWindowedScreen(WindowID(), 0, 0, EcranX, EcranY, 1, 0, 0)
nom$(1)="h,o,g,o,f,g,h,6,+,8,3,5,f,s,g,4,6,8,4,3,f,s,*,g,°"
nom$(2)="R,O,L,N,R,H,D,F,G,J,K,L,H,G,F,.,/,M,P,%,M,L,*,K,°"
nom$(3)="E,B,I,C,E,E,R,T,I,U,T,K,G,S,M,K,M,O,S,G,J,S,*,O,°"
nom$(4)="D,R,V,O,D,d,f,g,d,d,f,g,d,x,v,c,b,,,u,r,y,z,*,r,°"
nom$(5)=":,O,:,N,D,q,d,y,e,p,o,x,c,b,:,;,z,e,z,e,t,w,*,x,°"
nom$(6)="P,:,E,U,I,:,:,F,G,H,O,G,K,B,¨,B,J,K,S,G,?,S,*,D,°"
nom$(7)="O,R,L,:,X,:,e,t,i,u,t, ,p,t,z,u,r,z,t,_,ç,e,*,r,°"
nom$( 8 )="L,O,:,D,D,H,I,9,U,R,:,0,8,9,T,Z,R,T,P,R, ,P,*,Z,°"
nom$(9)="U,U,C,E,D,m,s,k,l,d,f,m,p,ç,o,r,j,t,m,z,g,j,*,s,°"
nom$(10)="X,Q,H,N,R,o,o,h,s,r,f,i,h,s,r,f,g,i,h, ,d,f,*,h,°"
nom$(11)="g,U,l,O,I,F,D,O,I,H,F,B,L,K, ,%,P,I,J,3,5, ,*,0,°"
nom$(12)="A,I,u,N,S,D,F,O,0,8,R,G,%,I,R,E,H,P,9,H,P,9,*,O,°"
n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,0,U,3,*,4,°"
nom$(30)="8,f,k,T,s,D,E,5,Y,3,5,Q,8,Q,Z,R,¨,8,E,5,Q,0,*,9,°"
de= Random(EcranX) :; on tire une colonne au hazard
; on crée un sprite
For spr=1 To 30
Resultat = CreateSprite(spr, 24,24*Len(nom$(spr)),0 )
;couleur =couleur+8
;If couleur >255
; couleur=255
;EndIf
; While index(spr)<=Len(nom$(spr))+1
While StringField(nom$(spr), index(spr), ",")<>"°"
index(spr)=index(spr)+1
car$ = StringField(nom$(spr), index(spr), ",")
y(spr)=y(spr)+24:; pour que le text descende
StartDrawing(SpriteOutput(spr))
BackColor(0, 0,0 )
c = c +7 :; on eclaircie la couleur !!
If c>255:c=0:EndIf
If car$ = "°"
c = 20
EndIf
FrontColor(0, c, 0)
If car$ = "*"
index(spr)=index(spr)+1
car$ = StringField(nom$(spr), index(spr), ",")
FrontColor(100, c,100 )
EndIf
;c=couleur
Locate(0, y(spr))
DrawingFont(FontID)
DrawText(car$)
StopDrawing()
Wend
Next spr
;ceci prepare les colonne qui vont etre solicite pour l'affichage, un "precalcul" en fait
If EcranX=640
col$="54,81,108,135,162,189,216,243,270,297,324,351,378,405,432,459,486,513,540,567,594,621,640,27"
EndIf
If EcranX=800
col$="54,81,108,135,162,189,216,243,270,297,324,351,378,405,432,459,486,513,540,567,594,621,648,675,702,729,756,783,800,27"
EndIf
If EcranX=1024
col$="54,81,108,135,162,189,216,243,270,297,324,351,378,405,432,459,486,513,540,567,594,621,648,675,702,729,756,783,810,837,864,891,918,945,972,999,1024,27"
EndIf
;***********************************
indexc=0
For ind=1 To 100
ysprite(ind)=0-Random(900)-900:; on tire une ligne de depart au dessus de l'ecran
If StringField(col$, indexc, ",")<>"27"
indexc=indexc+1
carcol$ = StringField(col$, indexc, ",")
de(ind)=Val(carcol$)
If carcol$=""
de(ind)=135
EndIf
Else
indexc=0
EndIf
Next ind
indexc=0
Repeat
RandomSeed(Random(255))
For ind=1 To 100
; si le sprite sort en bas
If ysprite(ind)>EcranY
ysprite(ind)=-Random(1900)-900:; on tire une ligne de depart au dessus de l'ecran
EndIf
spr=spr+1
If spr>29
spr=1
EndIf
;spr=1
; vitesse des sprites
ysprite(ind)=ysprite(ind)+Random( 8 )+5
DisplayTransparentSprite(spr, de(ind), ysprite(ind))
Next ind
FlipBuffers()
ClearScreen(0,0,0)
GetCursorPos_(Souris.POINT)
Until WindowEvent() = #PB_Event_CloseWindow Or Souris\x <> SourisOrigine\x Or Souris\y <> SourisOrigine\y
ShowCursor_(1)