Smooth Scrolling

 BBS: Inland Empire Archive
Date: 12-31-92 (12:05)             Number: 375
From: ROB SMETANA                  Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Smooth Scrolling               Conf: (2) Quik_Bas
'
' Someone recently requested a smooth scrolling utility.
' Here's one, plus some demo code.  I hope this helps.
' The demo is nothing fancy, but it shows that it does work.
' See the notes sprinkled throughout to experiment w/ different
' settings.
'
' Vertical AND horizontal smooth scrolling routines (text OR GFX)!
'
' NOTE:      Requires Smooth.Obj (see below)
'            EGA & VGA ONLY !!!!
'            We've run this in both PDS and QB.
'            Works in BOTH text and graphics modes.  See SCREEN 8!
'
' REQUIRES:  Smooth.Obj  (Run the debug script
'            through DEBUG to create Smooth.Obj.
'            The NEXT message has the debug script.)
'

DEFINT A-Z


'... SCREEN 8                   '...Try this in text mode.  Then
                                '   try Screen 8 (w/ higher speed).

COLOR 14, 0: CLS
LOCATE 4, 25
PRINT "Press <Escape> to move on.";

FOR x = 10 TO 24
    LOCATE x, 10
    PRINT STRING$(60, CHR$(55 + x));
    NEXT

Speed = 1                        '...Change this!  See notes.

'NOTES:  The higher the Speed, the faster the scroll.
'        Use Speed = 1 for subtle scrolling.
'        Try Speed = 5 (10 in graphics) for very fast scrolling.
'        Try Speed = 10+ (25 in gfx) to see some **real shaking**.
'
'        Even in text mode here, Row and Column use GRAPHICS MODE
'        pixel coordinates (ie., begin w/ 0,0).
'

'================================== demo Vertical smooth scrolling

Row = 0
Col = 0
WhichWay = Speed                '...start by going up

DO UNTIL INKEY$ = CHR$(27)      '...press Esc to end demo

   LOCATE 10, 1: PRINT Row;
   CALL SmoothScroll(Row, Col)

   Row = Row + WhichWay
   IF Row > 150 THEN            '...try 400 here
      WhichWay = -Speed         '...reverse direction
   ELSEIF Row < 1 THEN
      Row = 1
      WhichWay = Speed
   END IF
LOOP

CALL SmoothScroll(0, 0)         '... return to normal (sort of)

'================================= demo horizontal smooth scrolling
Row = 0
Col = 0
WhichWay = Speed                '...start by going left

DO UNTIL INKEY$ = CHR$(27)      '...press Esc to END demo

   LOCATE 1, 36: PRINT Col;
   CALL SmoothScroll(Row, Col)

   Col = Col + WhichWay
   IF Col > 65 THEN             '...try 300 here
      WhichWay = -Speed         '...reverse direction
   ELSEIF Col < 0 THEN
      Col = 0
      WhichWay = Speed
   END IF
LOOP

CALL SmoothScroll(0, 0)         '... return to normal (sort of)


--- RBBSMail 17.3A
 * Origin: PCUG BBS - San Francisco HST/V.32 415-621-2609 (RBBS 1:125/41.0)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET