home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / input / exam09.dba < prev    next >
Encoding:
Text File  |  1999-08-25  |  1.3 KB  |  62 lines

  1. Rem * Title  : HMD Controller
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ============================================
  5. rem DARK BASIC EXAMPLE PROGRAM 9
  6. rem ============================================
  7. rem This program detects HMD controller movement
  8. rem --------------------------------------------
  9.  
  10. rem Performs a checklist for all contol devices
  11. perform checklist for control devices
  12.  
  13. rem Simply select the first one it finds
  14. if checklist quantity()=0
  15.     print "You have no control devices available!"
  16.     print "Cannot continue with example"
  17.     end
  18. else
  19.     set control device checklist string$(1)
  20. endif
  21.  
  22. rem Set a gunsight in the middle of the screen
  23. x=320
  24. y=240
  25.  
  26. rem Activate manual sync
  27. sync on
  28.  
  29. rem Begin main loop
  30. do
  31.  
  32. rem Clear the screen each cycle
  33. cls
  34.  
  35. rem Show the analogue values
  36. set cursor 0,10
  37. print control device name$()
  38. print control device x()
  39. print control device y()
  40. print control device z()
  41.  
  42. rem Move the gunsight based on the control device axis value
  43. x=x+(control device x()/100)
  44. y=y+(control device y()/100)
  45.  
  46. rem Make sure the gunsight does not leave the screen
  47. if x<0 then x=0
  48. if x>640 then x=640
  49. if y<0 then y=0
  50. if y>480 then y=480
  51.  
  52. rem Draw a gunsight 
  53. circle x,y,20
  54. line x,y-20,x,y+20
  55. line x-20,y,x+20,y
  56.  
  57. rem Syncronise
  58. sync
  59.  
  60. rem End the loop
  61. loop
  62.