home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 63 / CDACTUAL63.iso / Aplicaciones / DarkBasic / DemoDarkBasic.exe / help / examples / input / exam10.dba < prev    next >
Encoding:
Text File  |  1999-12-03  |  1.2 KB  |  49 lines

  1. Rem * Title  : Force Feedback A
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ============================================
  5. rem DARK BASIC EXAMPLE PROGRAM 10
  6. rem ============================================
  7. rem This program uses simple force feedback
  8. rem --------------------------------------------
  9.  
  10. rem Performs a checklist for all contol devices
  11. perform checklist for control devices
  12.  
  13. rem Check for FF flag
  14. ffok=0
  15. for t=1 to checklist quantity()
  16.     if checklist value a(t)=1 then ffok=t
  17. next t
  18.  
  19. rem Assume the first one is a force feedback device
  20. if ffok=0
  21.     print "You have no force feedback control devices available!"
  22.     print "Cannot continue with example"
  23.     end
  24. else
  25.     print "Found ";checklist string$(ffok)
  26.     print "Use Arrow Keys and Spacebar"
  27.     set control device checklist string$(ffok)
  28. endif
  29.  
  30. rem Begin main loop
  31. do
  32.  
  33. rem Use cursor keys to control simple force
  34. if upkey()=1 then force up 100 : sleep 300
  35. if downkey()=1 then force down 100 : sleep 300
  36. if leftkey()=1 then force left 100 : sleep 300
  37. if rightkey()=1 then force right 100 : sleep 300
  38.  
  39. rem Press the spacebar to roll the force around 360 degrees
  40. if spacekey()=1
  41.     for r=1 to 360 step 32
  42.         force angle 100,r,100 : sleep 10
  43.     next r
  44. endif
  45.  
  46. rem End the loop
  47. loop
  48.  
  49.