JoyDown
Status = JoyDown(DeviceIndex)
 
Parameters:

    DeviceIndex = The Index of the joystick you wish to query
Returns:

    Status = The status of this direction (0= false, 1=true)
 

      JoyDown checks if a joystick is being pushed Down.




FACTS:


      * Joysticks can not be detected while the program is running, they must be connected before.




Mini Tutorial:


      The following example show a basic joystick implementation.

  
; Get the Screen Center
  Xpos=GetScreenWidth()/2
  Ypos=GetScreenHeight()/2
  
; start of Program loop
  Do
     
   ; Clear the screen
     Cls RGB(0,0,0)
     
   ; Display the title message
     Print "JoySticks present:"+Str$(JoySticksFound)
     Print "Use JoyStick to Move the Circle"
     
   ; Set the print cursor to 0,100
     SetCursor 0,100
     
     JoySticksFound=0
     
   ; Loop through and check the  4 possible Joystick devices
     For Device=1 To 4
        
      ; Check if this devices exists
        If JoyStatus(device)
           Print "JoyStick:"+Str$(device)
           
         ; check directional controls
           If JoyLeft(device) Then  Dec xpos
           If JoyRight(device) Then  Inc xpos
           If JoyUp(device) Then  Dec ypos
           If JoyDown(device) Then Inc ypos
           
         ; check the button States
           For button=1 To 10
              If JoyButton(device,Button)
                 Print "Pressing Button:"+Str$(Button)
              EndIf
           Next
           Print ""
           Inc JoySticksFound
        EndIf
        
     Next
     
     If JoySticksFound=0
        CenterText 400,100,"No JoyStick Present, Please Connect one !"
     EndIf
     
     Circle Xpos,Ypos,10,true
     Sync
  Loop
  




This example would output.

  
  no Text output
  

 
Related Info: JoyButton | JoyLeft | JoyRight | JoyStatus | JoyUp :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com