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

  1. Rem * Title  : Analogue Joystick
  2. Rem * Author : DBS-LB
  3. Rem * Date   : 1st Sept 99
  4. rem ===============================================
  5. rem DARK BASIC EXAMPLE PROGRAM 8
  6. rem ===============================================
  7. rem This program detects analogue joystick movement
  8. rem -----------------------------------------------
  9.  
  10. rem Set a coordinate in the middle of the screen
  11. x=320
  12. y=240
  13.  
  14. Rem Activate manual sync
  15. sync on
  16.  
  17. rem Begin main loop
  18. do
  19.  
  20. rem Clear screen
  21. cls
  22.  
  23. rem Show the analogue values
  24. set cursor 0,10
  25. print joystick x()
  26. print joystick y()
  27. print joystick z()
  28. print joystick slider a()
  29. print joystick slider b()
  30.  
  31. rem Move the coordinate based on the joystick axis value
  32. x=x+(joystick x()/100)
  33. y=y+(joystick y()/100)
  34.  
  35. rem Make sure the coordinate does not leave the screen
  36. if x<0 then x=0
  37. if x>640 then x=640
  38. if y<0 then y=0
  39. if y>480 then y=480
  40.  
  41. rem Draw a circle at the coordinate
  42. circle x,y,20
  43.  
  44. Rem Syncronise drawing
  45. sync
  46.  
  47. rem End the loop
  48. loop
  49.