05-02-2023, 09:51 AM
Hi Terry
I stress out " very good controller library!"
about the issue of detecting at will the controllers it stands up on _DEVICES keyword that is in development, so also using your fantastic library I stuck in the same issue.
Thank you for sharing this masterpiece that will grow up togeter QB64pe.
Screenshot of results of my attempt using your library
and here correlate QB64 code
Moreover I agree with you for thanking SMcNeill and all the others of the QB64pe development team.
I stress out " very good controller library!"
about the issue of detecting at will the controllers it stands up on _DEVICES keyword that is in development, so also using your fantastic library I stuck in the same issue.
Thank you for sharing this masterpiece that will grow up togeter QB64pe.
Screenshot of results of my attempt using your library
and here correlate QB64 code
Code: (Select All)
'$INCLUDE:'CONTROLLER.BI'
ReDim Shared Ax(1 To 1) As Integer, Bx(1 To 1) As Integer, Wx(1 To 1) As Integer
ReDim Shared Axm As Integer, Bxm As Integer, Wxm As Integer
Dim Kh As Integer
__INITIALIZE_CONTROLLERS ' initialize controller library
Cls
Print " Press ESC to quit and Enter to detect joystick"
Print " JoyStick Axis Buttons Wheels"
__IDENTIFY_CONTROLLERS 'Print IsJoystick%, Axm, Bxm, Wxm
View Print 4 To 24
Kh = 0
While Kh <> 27
Kh = _KeyHit
If (Kh) = 13 Then __IDENTIFY_CONTROLLERS: Print __CONTROLLER_NAME$(3), __BUTTON_TOTAL(3), __AXIS_TOTAL(3) 'Print IsJoystick%, Axm, Bxm, Wxm
Locate 24, 1: Print Kh;
_Limit 30
Wend
End
'*****************************************************************
' JOYSTICK DETECTION
'*****************************************************************
Function IsJoystick% ()
Dim HMD%: HMD% = HowManyDevice%
If HMD% = 0 Then
Print " No input devices!": End
Else
Locate , 1: Print HMD%
End If
If HMD% = 3 Then
Locate , 4: Print "Joystick detected"
IsJoystick% = -1
Axm = _LastAxis(3)
Bxm = _LastButton(3)
Wxm = _LastWheel(3)
Else
' all cases in which HMD% <>3
Locate , 10: Print " NO Joystick!"
IsJoystick% = 0
Axm = 0
Bxm = 0
Wxm = 0
End If
Print HMD%, Axm, Bxm, Wxm
End Function
Function HowManyDevice%
HowManyDevice% = 0 ' error value
HowManyDevice% = _Devices ' value detected
End Function
'*****************************************************************
' END Subs and Function for JOYSTICK DETECTION
'*****************************************************************
'$INCLUDE:'CONTROLLER.BM'
Moreover I agree with you for thanking SMcNeill and all the others of the QB64pe development team.