BBC BASIC for Windows
Programming >> Graphics and Games >> Christmas Scroller
http://bb4w.conforums.com/index.cgi?board=graphics&action=display&num=1228992547

Christmas Scroller
Post by GordonSweet on Dec 11th, 2008, 09:49am

Richard this you kindly helped me with some time ago used to work ok but now fails. I do not think I altered it in anyway. Gordon

Code:
      ON ERROR OSCLI "REFRESH ON" : IF ERR<>17 MODE 7 : REPORT : END
      MODE 7 : D$="  Merry Christmas to All."
      PRINT TAB(3,6);CHR$133"MERRY XMAS SCROLLER - Press:-";
      PRINT TAB(5,8);"1 = Comic Sans 2 = Courier"
      PRINT TAB(5);"3 = Times      4 = Arial"
      PRINT TAB(5);"5 = Bertram    6 = Broadway"
      PRINT TAB(4);CHR$131"7 = QUIT     Esc re-starts."
      Q=VAL(GET$) : IF Q<1 OR Q>7 VDU 7 : RUN
      
      SYS "GetSystemMetrics", 0 TO xscreen%
      SYS "GetSystemMetrics", 1 TO yscreen%
      VDU 23,22,xscreen%;yscreen%;8,16,16,0
      SYS "SetWindowPos", @hwnd%, -1, 0, 0, xscreen%, yscreen%, 0
      VDU 26
      
      OFF
      PROCstars
      
      CASE Q OF
        WHEN 1 : *FONT COMIC SANS MS,220,B
        WHEN 2 : *FONT COURIER NEW,220,B
        WHEN 3 : *FONT TIMES NEW ROMAN,220,B
        WHEN 4 : *FONT ARIAL,220,B
        WHEN 5 : *FONT BERTRAM,220,B
        WHEN 6 : *FONT BROADWAY,220,B
        WHEN 7: QUIT
      ENDCASE
      
      D$ += D$
      L% = LEN(D$)
      SYS "GetTextExtentPoint32", @memhdc%, D$, L%, ^X%
      VDU 5,24,0;yscreen%-Y%;xscreen%*2;yscreen%+Y%;
      GCOL 0,128 : REM Change 128 for a bar
      GCOL 0, 9
      
      x% = 0
      *REFRESH OFF
      REPEAT
        ORIGIN -x%,0
        MOVE 10,yscreen%+Y%
        N% = 1
        y% = @vdu%!12
        REPEAT
          PRINT MID$(D$,N%,1);
          N% += 1
        UNTIL (N% > L%) OR (@vdu%!12 <> y%)
        *REFRESH
        WAIT 2
        CLG
        x% += 8
        IF x% > X% x% = 0
        KEYEVENTF_KEYUP = 2
        VK_CONTROL = &11
        PROC_KeybdEvent(VK_CONTROL, 0) : REM simulates Ctrl Press
        PROC_KeybdEvent(VK_CONTROL, KEYEVENTF_KEYUP) : REM simulates Ctrl Release
      UNTIL FALSE
      
      DEF PROCstars
      COLOUR 0,0,50,0 : COLOUR 15 : CLG
      VDU 5
      FOR star% = 1 TO 50
        MOVE RND(xscreen%*2),RND(yscreen%*2): PRINT "*";
      NEXT : ENDPROC
      
      DEF PROC_KeybdEvent(key%, event%)
      SYS "keybd_event", key%, 0, event%, 0
      ENDPROC     
 

Re: Christmas Scroller
Post by admin on Dec 14th, 2008, 9:56pm

Quote:
Richard this you kindly helped me with some time ago used to work ok but now fails. I do not think I altered it in anyway.

Change the VDU 26 to read:

Code:
VDU 26,23,16,64;0;0;0; 


Re: Christmas Scroller
Post by GordonSweet on Dec 15th, 2008, 06:01am

Thanks Richard

Gordon