- * Basé sur un code de Olaf Doschke
- * et transformé en classe formulaire
- * à reserver aux traitements
- * qui ne souffriront pas d'un peu de CPU
- * en moins ...
-
- matrix = CREATEOBJECT("oMatrix", "INKEY(.01)=27")
- matrix.show()
-
- #DEFINE screenwidth 80
- #DEFINE screenheight 30
-
- DEFINE CLASS oMatrix as Form
- backcolor=RGB(0,0,0)
- fontname="Courier New"
- Caption="Reloadding..."
-
- FUNCTION init
- PARAMETERS cBreakCondition
- SET TALK off
- this.Width=screenwidth * FONTMETRIC(7, this.FontName, this.FontSize)
- this.Height=screenheight * FONTMETRIC(1, this.FontName, this.FontSize)+SYSMETRIC(9)
- this.AddProperty("BreakCondition", cBreakCondition)
- ENDFUNC
-
- FUNCTION activate
- DIMENSION protectedpositions[screenwidth,screenheight]
- DIMENSION trails[screenwidth,2]
- LOCAL cBreakCondition
- cBreakCondition = this.BreakCondition
-
- FOR x = 1 TO screenwidth
- FOR Y = 1 TO screenheight
- protectedpositions[x,y] = CHR(0)
- ENDFOR Y
- ENDFOR x
-
- DO WHILE .T.
- FOR ii = 1 TO 42
- x=INT(RAND()*screenwidth)
- Y=INT(RAND()*screenheight)
- IF protectedpositions[x+1,y+1] = CHR(0)
- this.FORECOLOR = RGB(0,RAND()*208,0)
- @Y,x SAY CHR(RAND()*224+32)
- ENDIF
- ENDFOR ii
-
- lntrail = RAND()*screenwidth+1
- IF EMPTY(trails[lntrail,1])
- trails[lntrail,1] = 1.0
- trails[lntrail,2] = RAND()*2.0+0.5
- ENDIF
-
- FOR lntrail = 1 TO screenwidth
- IF !EMPTY(trails[lntrail,1])
- lngreen = 255
- lcchar = CHR(RAND()*224+32)
- this.FORECOLOR = RGB(0,lngreen,0)
- Y = INT(trails[lntrail,1])
- IF Y<screenheight
- @ Y,lntrail-1 SAY lcchar
- protectedpositions[lntrail,y+1] = lcchar
- ENDIF
-
- FOR Y = Y-1 TO 0 STEP -1
- lngreen = MAX(lngreen - 7,0)
- IF lngreen >0
- this.FORECOLOR = RGB(0,lngreen,0)
- IF Y<screenheight
- @ Y,lntrail -1 SAY protectedpositions[lntrail,y+1]
- ENDIF
- ELSE
- IF Y<screenheight
- protectedpositions[lntrail,y+1] = CHR(0)
- ENDIF
- ENDIF
- ENDFOR Y
-
- trails[lntrail,1] = trails[lntrail,1] + trails[lntrail,2]
- IF trails[lntrail,1] > 1.5 * screenheight
- trails[lntrail,1] = 0
- FOR Y = 1 TO screenheight
- protectedpositions[lntrail,y] = CHR(0)
- this.FORECOLOR = RGB(0,0,0)
- @ Y,lntrail-1 SAY ' '
- ENDFOR Y
- ENDIF
- ENDIF
- ENDFOR lntrail
-
- cBreakCondition = this.BreakCondition
-
- DOEVENTS && FORCE
- IF &cBreakCondition
- EXIT
- ENDIF
-
- ENDDO
- RELEASE protectedpositions
- RELEASE trails
- this.release()
- ENDFUNC
-
- ENDDEFINE
-
-
* Basé sur un code de Olaf Doschke
* et transformé en classe formulaire
* à reserver aux traitements
* qui ne souffriront pas d'un peu de CPU
* en moins ...
matrix = CREATEOBJECT("oMatrix", "INKEY(.01)=27")
matrix.show()
#DEFINE screenwidth 80
#DEFINE screenheight 30
DEFINE CLASS oMatrix as Form
backcolor=RGB(0,0,0)
fontname="Courier New"
Caption="Reloadding..."
FUNCTION init
PARAMETERS cBreakCondition
SET TALK off
this.Width=screenwidth * FONTMETRIC(7, this.FontName, this.FontSize)
this.Height=screenheight * FONTMETRIC(1, this.FontName, this.FontSize)+SYSMETRIC(9)
this.AddProperty("BreakCondition", cBreakCondition)
ENDFUNC
FUNCTION activate
DIMENSION protectedpositions[screenwidth,screenheight]
DIMENSION trails[screenwidth,2]
LOCAL cBreakCondition
cBreakCondition = this.BreakCondition
FOR x = 1 TO screenwidth
FOR Y = 1 TO screenheight
protectedpositions[x,y] = CHR(0)
ENDFOR Y
ENDFOR x
DO WHILE .T.
FOR ii = 1 TO 42
x=INT(RAND()*screenwidth)
Y=INT(RAND()*screenheight)
IF protectedpositions[x+1,y+1] = CHR(0)
this.FORECOLOR = RGB(0,RAND()*208,0)
@Y,x SAY CHR(RAND()*224+32)
ENDIF
ENDFOR ii
lntrail = RAND()*screenwidth+1
IF EMPTY(trails[lntrail,1])
trails[lntrail,1] = 1.0
trails[lntrail,2] = RAND()*2.0+0.5
ENDIF
FOR lntrail = 1 TO screenwidth
IF !EMPTY(trails[lntrail,1])
lngreen = 255
lcchar = CHR(RAND()*224+32)
this.FORECOLOR = RGB(0,lngreen,0)
Y = INT(trails[lntrail,1])
IF Y<screenheight
@ Y,lntrail-1 SAY lcchar
protectedpositions[lntrail,y+1] = lcchar
ENDIF
FOR Y = Y-1 TO 0 STEP -1
lngreen = MAX(lngreen - 7,0)
IF lngreen >0
this.FORECOLOR = RGB(0,lngreen,0)
IF Y<screenheight
@ Y,lntrail -1 SAY protectedpositions[lntrail,y+1]
ENDIF
ELSE
IF Y<screenheight
protectedpositions[lntrail,y+1] = CHR(0)
ENDIF
ENDIF
ENDFOR Y
trails[lntrail,1] = trails[lntrail,1] + trails[lntrail,2]
IF trails[lntrail,1] > 1.5 * screenheight
trails[lntrail,1] = 0
FOR Y = 1 TO screenheight
protectedpositions[lntrail,y] = CHR(0)
this.FORECOLOR = RGB(0,0,0)
@ Y,lntrail-1 SAY ' '
ENDFOR Y
ENDIF
ENDIF
ENDFOR lntrail
cBreakCondition = this.BreakCondition
DOEVENTS && FORCE
IF &cBreakCondition
EXIT
ENDIF
ENDDO
RELEASE protectedpositions
RELEASE trails
this.release()
ENDFUNC
ENDDEFINE