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

  1. Rem * Title  : GOSUB Commands
  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 show you how to use gosub command
  8. rem -----------------------------------------------------------
  9.  
  10. rem Set the ink to white and paper color to black 
  11. ink rgb(244,214,210),1
  12.  
  13. startofprogram:
  14.  
  15. rem Clear the screen
  16. cls
  17.  
  18. print "PLEASE PRESS LEFT OR RIGHT MOUSE BUTTON"    
  19.  
  20. rem Start of the main loop
  21. do
  22.  
  23.     rem Check for left mouse button 
  24.     if mouseclick()=1
  25.         rem jump to label leftbutton
  26.         gosub leftbutton
  27.     endif
  28.     
  29.     rem Check for right mouse button
  30.     if mouseclick()=2 
  31.         rem jump to label rightbutton
  32.         gosub rightbutton
  33.     endif
  34.  
  35. rem End of the main loop    
  36. loop
  37.  
  38.  
  39. rem this a label leftbutton
  40. leftbutton:
  41.  
  42. print "YOU HAVE PRESSED THE LEFT MOUSE BUTTON"
  43.  
  44. rem wait till no mouse button are pressed
  45. repeat:until mouseclick()=0
  46.  
  47. rem clear the screen
  48. cls
  49.  
  50. print "PLEASE PRESS LEFT OR RIGHT MOUSE BUTTON"    
  51.  
  52. rem return will jump back to the next command 
  53. rem after gosub leftbutton
  54. return
  55.  
  56. rem this is label rightbutton
  57. rightbutton:
  58.  
  59. print "YOU HAVE PRESSED THE RIGHT MOUSE BUTTON"
  60.  
  61. rem wait till no mouse button are pressed
  62. repeat:until mouseclick()=0
  63.  
  64. rem clear the screen
  65. cls
  66.  
  67. print "PLEASE PRESS LEFT OR RIGHT MOUSE BUTTON"    
  68.  
  69. rem return will jump back to the next command 
  70. rem after gosub rightbutton
  71. return
  72.  
  73.  
  74.  
  75.