home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / bobs / exam05.dba < prev    next >
Encoding:
Text File  |  1999-09-07  |  1.5 KB  |  71 lines

  1. Rem * Title  : Scaling a Bob
  2. Rem * Author : DBS-MB
  3. Rem * Date   : 1st August 99
  4. rem ===================================================
  5. rem DARK BASIC EXAMPLE PROGRAM 5
  6. rem ===================================================
  7. rem This program will draw a scale a bob on screen 
  8. rem ---------------------------------------------------
  9.  
  10. rem Set the ink to white and paper color to black 
  11. ink rgb(244,214,210),1
  12.  
  13. rem Load a bitmap on to the screen
  14. load bitmap "face.bmp"
  15.  
  16. rem Grab image 1 from bitmap
  17. get image 1,18,17,156,196
  18.  
  19. rem clear the screen
  20. cls
  21.  
  22. rem now we will make a bob and draw it off screen
  23. bob 1,100,100,1
  24.  
  25. rem get bob width and find the middle of it going across
  26. rem get bob height and find the middle of it going down
  27. rem new offset for bob 1 
  28.  
  29. offset bob 1,(bob width(1)/2),(bob height(1)/2)
  30.  
  31. rem the is were on screen bob will appear
  32. acrossscreen=(640/4)
  33. downscreen=(480/4)
  34.  
  35. rem press left mouse button to quit
  36. rem move mouse left and right to resize bob
  37.  
  38. repeat
  39.  
  40.     if returnkey()=1
  41.         cls 0
  42.         set cursor 0,0
  43.         print "using the scale bob command"
  44.         print "bob x ",bob x(1)
  45.         print "bob y ",bob y(1)
  46.         print "bob scale x ",bob scale x(1)
  47.         print "bob scale y ",bob scale y(1)
  48.         repeat:until returnkey()<>1
  49.         cls
  50.     endif
  51.  
  52.     rem draw the bob at the new position
  53.     bob 1,acrossscreen,downscreen,1
  54.  
  55.     rem resize bob
  56.     scale bob 1,mousex()
  57.  
  58. until mouseclick()=1
  59.  
  60. rem clear the screen
  61. cls 
  62.  
  63. rem remove the bob from memory
  64. delete bob 1
  65.  
  66. rem remove image 1 from memory
  67. delete image 1
  68.  
  69. rem End the program
  70. end
  71.