Guidance
指路人
g.yi.org
software / rapidq / Examples / Console / movetext / MOVETEXT.BAS

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' Moving/Spotlight text, converted to Rapid-Q by William Yu

     $APPTYPE CONSOLE

'===========================================================================
' Subject: MOVING TEXT ACROSS SCREEN         Date: 06-07-99 (11:40)
'  Author: Dieter Folger                     Code: PB
'  Origin: folger@bamberg.baynet.de        Packet: TEXT.ABC
'===========================================================================
     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 'Screenline to show the text

'--------------------
     SUB MoveText (y AS INTEGER, T$ AS STRING)
'--------------------
      DIM c(1 TO 8) AS INTEGER     'define params
      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 ' text length 78 max
      END IF
      x = (80 - l) \ 2   ' center text
      ox = x : p = 1
      Dirs = 0 'direction right
      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 'change direction
       END IF
       SLEEP .1
      LOOP UNTIL INKEY$<>""
     END SUB

     MoveText y, T$

掌柜推荐
 
 
¥860.00 ·
 
 
¥410.00 ·
 
 
¥288.00 ·
 
 
¥918.00 ·
 
 
¥288.00 ·
 
 
¥264.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:1999-07-21 14:54:30