home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 101.img / QB45-1.ZIP / PLOTTER.BAS < prev    next >
BASIC Source File  |  1987-09-23  |  2KB  |  55 lines

  1. ' Values for keys on the numeric keypad and the spacebar:
  2. CONST UP = 72, DOWN = 80, LFT = 75, RGHT = 77
  3. CONST UPLFT = 71, UPRGHT = 73, DOWNLFT = 79, DOWNRGHT = 81
  4. CONST SPACEBAR = " "
  5.  
  6. ' Null$ is the first character of the two-character INKEY$
  7. ' value returned for direction keys such as UP and DOWN:
  8. Null$ = CHR$(0)
  9.  
  10. ' Plot$ = "" means draw lines; Plot$ = "B" means move
  11. ' graphics cursor, but don't draw lines:
  12. Plot$ = ""
  13.  
  14. PRINT "Use the cursor movement keys to draw lines."
  15. PRINT "Press the spacebar to toggle line drawing on and off."
  16. PRINT "Press <ENTER> to begin. Press q to end the program."
  17. DO: LOOP WHILE INKEY$ = ""
  18.  
  19. SCREEN 1
  20. CLS
  21.  
  22. DO
  23.    SELECT CASE KeyVal$
  24.       CASE Null$ + CHR$(UP)
  25.          DRAW Plot$ + "C1 U2"
  26.       CASE Null$ + CHR$(DOWN)
  27.          DRAW Plot$ + "C1 D2"
  28.       CASE Null$ + CHR$(LFT)
  29.          DRAW Plot$ + "C2 L2"
  30.       CASE Null$ + CHR$(RGHT)
  31.          DRAW Plot$ + "C2 R2"
  32.       CASE Null$ + CHR$(UPLFT)
  33.          DRAW Plot$ + "C3 H2"
  34.       CASE Null$ + CHR$(UPRGHT)
  35.          DRAW Plot$ + "C3 E2"
  36.       CASE Null$ + CHR$(DOWNLFT)
  37.          DRAW Plot$ + "C3 G2"
  38.       CASE Null$ + CHR$(DOWNRGHT)
  39.          DRAW Plot$ + "C3 F2"
  40.       CASE SPACEBAR
  41.          IF Plot$ = "" THEN Plot$ = "B " ELSE Plot$ = ""
  42.       CASE ELSE
  43.          ' The user pressed some key other than one of the
  44.          ' direction keys, the  spacebar, or "q", so
  45.          ' don't do anything.
  46.    END SELECT
  47.  
  48.    KeyVal$ = INKEY$
  49.  
  50. LOOP UNTIL KeyVal$ = "q"
  51.  
  52. SCREEN 0, 0
  53. WIDTH 80
  54. END
  55.