



Code : Tout sélectionner
;/*********************************************
;/* \\ Effect // *
;/* \\ Made in Garzul | 2004 // *
;/* \\JaPBe > 2.4.7.17 || Purebasic > 3.91 // *
;/*********************************************
;Init component
If InitSprite() = 0 Or InitKeyboard() = 0
MessageRequester("Erreur", "Impossible d'initialiser directx7 ou plus", #MB_Iconerror)
End
EndIf
;-Open Screen
If OpenScreen(1024,768,32,"") = 0
MessageRequester("Erreur", "Impossible d'ouvrir l'écran", #MB_Iconerror)
End
EndIf
;Refresh screen in 60
SetRefreshRate(60)
;Variable
Angle = 0
AffichAngle = 1
Red = Random(255)
Green = Random(255)
Blue = Random(255)
XPosition = 400
YPosition = 400
Size = 1
Size = 1
AffichHelp = 0
;Delay(2000)
;******************************* Boucle ********************************
Repeat
ClearScreen(0,0,0)
;Effect particle
If AffichAngle = 1
Angle + 1
EndIf
If Angle > 50 And AffichAngle = 1
AffichAngle = 0
EndIf
If AffichAngle = 0 And Angle < 1
AffichAngle = 1
EndIf
If AffichAngle = 0
Angle - 1
EndIf
;-Create particle
For i = 0 To XPosition Step 20
For e = 0 To YPosition Step 20
StartDrawing(ScreenOutput())
Box(300 + i + Random(Angle),150 + e + Random(angle),Size,Size,RGB(Red,Green,Blue))
StopDrawing()
Next
Next
;Display text
StartDrawing(ScreenOutput())
DrawingMode(1)
FrontColor(0 , 200 , 0 )
DrawText("Angle = " + Str(Angle))
Locate(0, 20)
DrawText("Particle color ( RGB ) = " + Str(Red) + " , " + Str(Green) + " , " + Str(Blue))
Locate(0, 40)
DrawText("Size particle zone = X " + Str(XPosition) + " , Y " + Str(YPosition))
Locate(0, 60)
DrawText("Particle size = " + Str(Size))
Locate(0, 80)
DrawText("Help = F1")
StopDrawing()
;Set color and block color
ExamineKeyboard()
If Keyboardreleased(#PB_Key_R)
Red + 1
ElseIf Keyboardreleased(#PB_Key_G)
Green + 1
ElseIf Keyboardreleased(#PB_Key_B)
Blue + 1
EndIf
If Red > 255
Red = 0
ElseIf Green > 255
Green = 0
ElseIf Blue > 255
Blue = 0
EndIf
;Size particle zone
If KeyboardReleased(#PB_Key_Up)
YPosition + 1
ElseIf KeyboardReleased(#PB_Key_Down)
YPosition - 1
ElseIf KeyboardReleased(#PB_Key_Right)
XPosition + 1
ElseIf KeyboardReleased(#PB_Key_Left)
XPosition - 1
EndIf
;Particle size and block size in after 60 and 0
If KeyboardReleased(#PB_Key_Add)
Size + 1
ElseIf KeyboardReleased(#PB_Key_Subtract)
Size - 1
EndIf
If Size < 0
Size = 0
ElseIf Size > 60
Size = 60
EndIf
;DisplayHelp
If KeyboardReleased(#PB_Key_F1) And AffichHelp = 0
AffichHelp = 1
EndIf
If AffichHelp = 1
StartDrawing(ScreenOutput())
DrawingMode(1)
FrontColor(0 , 200 , 200 )
Locate(200, 740)
DrawText("Key function : Change color = R , G , B : Change particle zone = Moving keys : Particle size = + and -")
StopDrawing()
EndIf
;Close Help
If AffichHelp = 1
If KeyboardPushed(#PB_Key_F1)
AffichHelp = 0
EndIf
EndIf
;Inverse to buffer :)
FlipBuffers()
;****************************** End ************************************
Until KeyboardPushed(#PB_Key_escape)
End