home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / 501-525 / apd511 / scroller1-3.amos / scroller1-3.amosSourceCode
AMOS Source Code  |  1991-01-15  |  3KB  |  95 lines

  1. '--------------------------------------------------------------------------
  2. ' SCROLLER DEMO  
  3. '
  4. ' This is a scroller that uses Amiga fonts. Fonts sizes greater than ~28 
  5. ' will flicker.  Warning: This prog closes the Workbench so you will have
  6. ' boot out of it.  
  7. '
  8. ' Here are limits on the font size. (Written on a A1000 with 3 megs) 
  9. '
  10. '          Colours  Font size
  11. '  Hires.     4        17    
  12. '             2        24  
  13. '  Lowres    32        15  
  14. '            16        20
  15. '             8        24
  16. '             4        28  
  17. '             2        36  
  18. '
  19. ' Robert Farnsworth
  20. ' 1 Vidovic Ave, Mildura, 3500 
  21. ' December 1990. 
  22. '------------------------------------------------------------------------- 
  23. '
  24. ' THIS IS A MUST FOR SMOOTH SCROLLING
  25. Close Workbench 
  26. '
  27. TXT$="This is a Scroller routine that uses the standard AMIGA fonts.  It works in HIRES or LOWRES, and has selectable scroll speed.  R. G. Farnsworth, December 1990."
  28. '
  29. ' Make the screen about 100 pixels wider than SCRWIDTH (the viewable screen).
  30. ' More if some characters are really wide - like "W" and "M".
  31. '
  32. SCRWIDTH=320
  33. Screen Open 0,SCRWIDTH+150,256,16,Lowres
  34. Screen Display 0,128,42,SCRWIDTH,
  35. Flash Off : Curs Off 
  36. '
  37. Get Fonts 
  38. LF=1
  39. While Font$(LF)<>"" : Inc LF : Wend 
  40. '
  41. Print "          AMIGA-FONTS SCROLLER"
  42. Print 
  43. Print "        (Press Spacebar to pause)"
  44. '
  45. For F=1 To LF-1
  46.    SP=Rnd(9)+1
  47.    Locate 0,7 : Cline : Print "Font:";F;"  Speed:";SP
  48.    Print At(0,10);Font$(F)
  49.    SCRL[TXT$,F,SP,SCRWIDTH]
  50. Next 
  51. End 
  52. '
  53. Procedure SCRL[T$,FONT,SPEED,SWIDTH]
  54.    '
  55.    ' This is a scroller routine that uses Amiga fonts, any size,
  56.    ' proportional and non proportional.  It will work with both 
  57.    ' Hires and Lowres screens.  Scrolling is very smooth for fonts
  58.    ' sizes upto about 36, depending on the resolution used and the
  59.    ' number of bitplanes used.  The Workbench MUST be closed if you want
  60.    ' smooth scrolling (also eliminate any background tasks, such as POPCLI).
  61.    '
  62.    '       T$ -  The text string to be scrolled.
  63.    '     FONT -  The number of the font to be used. 
  64.    '   SWIDTH -  The viewable width of the screen, usually 320 or 640.
  65.    '             (The screen must be approx 100 pixels wider than SWIDTH.)
  66.    '    SPEED -  The scrolling speed - 1 is slow, 3 about right, 8 is fast. 
  67.    '
  68.    SPEED=Max(1,SPEED) : FONT=Max(1,FONT)
  69.    Set Font FONT
  70.    FONTHEIGHT=Val(Mid$(Font$(FONT),30,3))
  71.    Def Scroll 1,1,Screen Height-FONTHEIGHT To Screen Width,Screen Height,-SPEED,0
  72.    F=(SWIDTH/(Text Length(" ")))+3
  73.    T$=T$+String$(" ",F)
  74.    BL=Screen Height-(FONTHEIGHT-Text Base)
  75.    '
  76.    P=0 : I=1
  77.    Repeat 
  78.       If P<0
  79.          Text SWIDTH+P,BL,Mid$(T$,I,1)+" "
  80.          P=P+Text Length(Mid$(T$,I,1))
  81.          Inc I
  82.       End If 
  83.       L=Text Length(Mid$(T$,I,1))
  84.       Text SWIDTH+P,BL,Mid$(T$,I,1)+" "
  85.       C=0
  86.       Repeat 
  87.          Scroll 1
  88.          C=C+SPEED
  89.          Wait Vbl 
  90.       Until C=>L
  91.       P=P-C+L
  92.       Inc I
  93.       While Key State(64) : Wend 
  94.    Until I>Len(T$)
  95. End Proc