DQBjoyDetected
FUNCTION

Prototype

DECLARE FUNCTION DQBjoyDetected (BYVAL JoyNum)

Parameters

JoyNum - Joystick number to detect

Returns

True if specified joystick has been detected, otherwise false

Description

This function should be called before using the other joystick functions, to detect if a joystick is available. The parameter JoyNum can be 0 for joystick 1, 1 for joystick 2 or 2 for 4-button joystick. If you can't remember this, just call this function, as well as the other joystick functions, with the constants JOY1, JOY2 and GAMEPAD defined into the file DIRECTQB.BI, and explained into appendix A.

Notes:

none

Example

*****************************************************************************

' All integers for speed
DEFINT A-Z

'$INCLUDE:'DIRECTQB.BI'

' Let's initialize the library with no extra layers nor sounds nor EMS
IF DQBinit(0, 0, 0) THEN DQBclose: PRINT DQBerror$: END

' Finds if joystick 1 is available
IF DQBjoyDetected(JOY1) THEN
    PRINT "Joystick 1 detected"
ELSE
    PRINT "Joystick 1 not detected"
END IF

' Waits for the user to press a key
WHILE INKEY$ = "": WEND

' Ends program
DQBclose

*****************************************************************************