home *** CD-ROM | disk | FTP | other *** search
/ DarkBasic Professional / DarkBasicPro.iso / data1.cab / Lang_Files_(English) / Help / examples / text / text1-example.dba < prev    next >
Encoding:
Text File  |  2004-09-22  |  1.3 KB  |  61 lines

  1. rem Text Showcase
  2.  
  3. rem Declaration for function
  4. global sinwave#
  5.  
  6. rem Standard Setup Code for all examples
  7. sync on : sync rate 0
  8.  
  9. rem Setup Font
  10. set text font "book" : set text size 20
  11. set text to bold : set text transparent
  12.  
  13. rem Scroll text
  14. string$=space$(36)
  15. string$=string$+"Dark Basic Professional gives you the power of past ages as well as the bounty of future technologies..."
  16. string$=string$+space$(10)
  17.  
  18. rem Main loop
  19. desc$="Retro Text Scroller"
  20. do
  21.  
  22. rem Nice backdrop
  23. prettybackdrop()
  24.  
  25. rem Scrolling text
  26. spacer=spacer+1
  27. if spacer>20
  28.  spacer=0 : scx=scx+1
  29.  if scx>len(string$) then scx=0
  30. endif
  31. sinwave#=wrapvalue(sinwave#+1)
  32. for x=0 to 32
  33.  if 1+x+scx<=len(string$) then a$=mid$(string$,1+x+scx) else a$=mid$(string$,(1+x+scx)-len(string$))
  34.  text (x*20)-spacer,220-(cos(sinwave#+((x+scx)*10))*50),upper$(a$)
  35. next x
  36.  
  37. rem Show Framerate
  38. text 20,screen height()-40,desc$
  39. fps$="DBPro Fps: "+str$(screen fps())
  40. text screen width()-20-text width(fps$),screen height()-40,fps$
  41.  
  42. rem Update screen
  43. sync
  44.  
  45. rem End loop
  46. loop
  47.  
  48. function prettybackdrop()
  49.  yy=0
  50.  red=rgb(128+(cos(sinwave#)*127),0,0)
  51.  green=rgb(0,128-(sin(sinwave#)*127),0)
  52.  for y=0 to 49
  53.   col=1-col
  54.   ys=10
  55.   if col=0 then box 0,yy,640,yy+ys,green,red,green,red
  56.   if col=1 then box 0,yy,640,yy+ys,red,green,red,green
  57.   yy=yy+ys
  58.  next y
  59. endfunction
  60.  
  61.