home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / compiler / sample8.bas < prev    next >
BASIC Source File  |  1993-11-13  |  835b  |  60 lines

  1.  
  2.  
  3. rem
  4. rem Demonstration of graphics mode and mouse usage.
  5. rem
  6.  
  7.  
  8. rem
  9. rem Go into graphics mode and find out how big window is
  10. rem
  11.  
  12.     screen 1000
  13.     maxx=system(10)-1
  14.     maxy=system(11)-1
  15.  
  16.  
  17. rem
  18. rem turn mouse on
  19. rem
  20.  
  21.     a=mouseon
  22.     if a=0 then
  23.       print "This program requires a mouse."
  24.       input z
  25.       stop
  26.     end if
  27.  
  28.  
  29. rem
  30. rem loop and look for buttons
  31. rem
  32. rem  If left button pressed, color pixel where we are.
  33. rem  If right button pressed, set pixel where we are to background color
  34. rem
  35.  
  36. 100
  37.  
  38.      if inkey$<>"" then stop
  39.  
  40.      x=mousex
  41.      y=mousey
  42.      b=mouseb
  43.  
  44.      right=b and 1
  45.      if right>0 then
  46.          pset (x,y)
  47.          goto 100
  48.      end if
  49.  
  50.      left=b and 2
  51.      if left>0 then
  52.        preset (x,y)
  53.        goto 100
  54.      end if
  55.  
  56.      goto 100
  57.  
  58.  
  59.  
  60.