$APPTYPE CONSOLE
CLS
DIM T$ AS STRING
DIM Y AS INTEGER
SETCONSOLETITLE "Moving text"
T$ = "Moving text across the screen similar as seen in XREAD"
y = 10
SUB MoveText (y AS INTEGER, T$ AS STRING)
DIM c(1 TO 8) AS INTEGER
DIM startcol AS INTEGER, endcol AS INTEGER, l AS INTEGER
DIM x AS INTEGER, ox AS INTEGER, p AS INTEGER, Dirs AS INTEGER
DIM I AS INTEGER
c(1) = 8 : c(2) = 7
c(3) = 15: c(4) = 15
c(5) = 15: c(6) = 7
c(7) = 8 : StartCol = 7
EndCol = 8 :l = LEN(T$)
IF l > 78 THEN
T$ = LEFT$(T$,78) : l = 78
END IF
x = (80 - l) \ 2
ox = x : p = 1
Dirs = 0
DO
IF l - p + 1 < 8 THEN
EndCol = l - p + 1
END IF
IF p = 0 THEN
Endcol = Endcol -1 : p = 1 : x = ox
IF EndCol = StartCol - 1 THEN
Dirs = 0 : StartCol = 7 : EndCol = 8
END IF
END IF
LOCATE y, x
PRINT " ";
FOR i = StartCol TO EndCol
COLOR c(i)
PRINT MID$(T$,p+i-StartCol,1);
NEXT
PRINT " ";
IF StartCol > 1 THEN
StartCol = StartCol - 1
END IF
IF Dirs = 0 THEN
IF StartCol = 1 THEN
x = x + 1 : p = p + 1
END IF
END IF
IF Dirs = 1 THEN
x = x - 1
p = p - 1
END IF
IF p = l THEN
Dirs = 1
END IF
SLEEP .1
LOOP UNTIL INKEY$<>""
END SUB
MoveText y, T$
|