11-13-2023, 06:26 AM
Code: (Select All)
_TITLE "MATRIX v1.0"
'-----| by harixxx
'-----| 6-16-2010
CONST object = 128
CONST tail = 64
CONST title$ = " CCNT "
TYPE Event
tyme AS STRING * 8
image AS STRING * 12
length AS INTEGER
audio AS STRING * 12
END TYPE
DIM SHARED events(100) AS Event
LoadEvents
MatrixClock
'----------------------
SUB MatrixClock
SCREEN _NEWIMAGE(640, 480, 256)
VIEW PRINT 1 TO 30
RANDOMIZE TIMER
DIM Char(3, object, tail), CharSet(52) AS STRING * 1
FOR i = 0 TO 63
OUT 968, i
OUT 969, 0
OUT 969, i
OUT 969, 0
NEXT
FOR i = 0 TO 36
CharSet(i) = CHR$(i + 129)
NEXT
FOR i = 37 TO 52
CharSet(i) = CHR$(i + 187)
NEXT
FOR i = 1 TO object
Char(0, i, tail) = INT(RND * 80) + 1
Char(1, i, tail) = INT(RND * 30) + 1
Char(2, i, tail) = RND * 52
Char(3, i, tail) = RND + .1
NEXT
_FULLSCREEN
DO
REDIM bg(80, 30)
COLOR 1
LOCATE 1, 1
PRINT title$
tm$ = TIME$
hr% = VAL(LEFT$(tm$, INSTR(tm$, ":") - 1))
IF hr% > 12 THEN hr% = hr% - 12
tm$ = LTRIM$(STR$(hr%)) + RIGHT$(tm$, LEN(tm$) - INSTR(tm$, ":") + 1)
IF LEN(tm$) < 8 THEN tm$ = "0" + tm$
PRINT " "; tm$; " "
IF RIGHT$(tm$, 2) = "00" THEN CheckForEvent TIME$
FOR i = 0 TO 28
FOR j = 0 TO 78
IF POINT(j, i) > 0 THEN
bg(j + 1, i + 1) = 40
bg(j + 2, i + 1) = -20
bg(j + 2, i + 2) = -20
END IF
NEXT j, i
FOR i = 1 TO object
FOR j = 1 TO tail - 1
FOR k = 0 TO 2
Char(k, i, j) = Char(k, i, j + 1)
NEXT
IF RND < .1 THEN Char(k, i, j) = (Char(k, i, j) + 1) MOD 53
NEXT
Char(1, i, tail) = Char(1, i, tail) + Char(3, i, tail)
IF Char(1, i, tail) > 30 THEN
Char(0, i, tail) = INT(RND * 80) + 1
Char(1, i, tail) = 1
Char(2, i, tail) = RND * 52
Char(3, i, tail) = RND + .1
END IF
Char(2, i, tail) = (Char(2, i, tail) + 1) MOD 53
NEXT
FOR i = 1 TO object
FOR j = 1 TO tail
yy = Char(1, i, j)
xx = Char(0, i, j)
IF yy > 0 AND yy < 31 AND xx > 0 AND xx < 81 THEN
IF j = tail THEN c = 35 ELSE c = INT(j / tail * 30)
c = c + bg(xx, yy)
c = 1 * -(c < 1) + c * -(c > 0)
c = 63 * -(c > 63) + c * -(c < 64)
COLOR c
LOCATE yy, xx
PRINT CharSet(Char(2, i, j));
END IF
NEXT j, i
_DISPLAY
LOOP UNTIL INKEY$ > ""
SYSTEM
END SUB
'----------------------
SUB LoadEvents
DIM eventcount%
eventcount% = 0
OPEN "events.txt" FOR INPUT AS #1
DO
LINE INPUT #1, event$
IF LEFT$(event$, 1) <> ";" AND LEFT$(event$, 1) <> "*" THEN
eventcount% = eventcount% + 1
events(eventcount%).tyme = event$
LINE INPUT #1, event$
events(eventcount%).image = event$ + ".bmp"
events(eventcount%).audio = event$ + ".wav"
LINE INPUT #1, event$
events(eventcount%).length = VAL(event$)
END IF
LOOP UNTIL LEFT$(event$, 1) = "*"
CLOSE #1
END SUB
'----------------------
SUB CheckForEvent (tm$)
END SUB
A Matrx-style clock, from over a dozen years ago, written in QB64 -- and still working!!
Takes the file here, which goes with it:
events.txt (Size: 1.18 KB / Downloads: 50)
Be certain to grab the events.txt and place it in the QB64 folder (or wherever you want it and point it to it), and this should compile and run with no issues.