home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / input / exam06.dba < prev    next >
Encoding:
Text File  |  2000-04-01  |  1.3 KB  |  50 lines

  1. Rem * Title  : Simple Keyboard
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem =============================================
  5. rem DARK BASIC EXAMPLE PROGRAM 6
  6. rem =============================================
  7. rem This program provides simple keyboard control
  8. rem ---------------------------------------------
  9.  
  10. rem Set a coordinate in the middle of the screen
  11. x=320
  12. y=240
  13.  
  14. rem Actuvate manual sync
  15. sync on
  16.  
  17. rem Begin main loop
  18. do
  19.  
  20. rem Clear the screen each cycle
  21. cls
  22.  
  23. rem Show the current inkey$ and scancode value
  24. set cursor 0,10
  25. print "Try using ARROW KEYS, CONTROL, SPACEBAR, SHIFT and RETURN"
  26. print "Try pressing the RIGHT CONTROL KEY to flag Keystate 157"
  27. print "Inkey$()=";inkey$();"  Scancode=";scancode();"  Keystate(157)=";keystate(157)
  28.  
  29. rem Move the coordinate based on the keyboard input
  30. if upkey()=1 then y=y-1
  31. if downkey()=1 then y=y+1
  32. if leftkey()=1 then x=x-1
  33. if rightkey()=1 then x=x+1
  34.  
  35. rem Set the ink color based on the keyboard control keys
  36. if controlkey()=1 then ink rgb(255,0,0),0
  37. if shiftkey()=1 then ink rgb(0,255,0),0
  38. if spacekey()=1 then ink rgb(0,0,255),0
  39. if returnkey()=1 then ink rgb(64,0,64),0
  40. if escapekey()=1 then end
  41.  
  42. rem Draw a circle at the coordinate
  43. circle x,y,20
  44.  
  45. rem Update screen
  46. sync
  47.  
  48. rem End the loop
  49. loop
  50.