Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Controller Library
#8
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

[Image: immagine-2023-05-02-114448700.png]

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.
Reply


Messages In This Thread
Controller Library - by TerryRitchie - 04-12-2023, 03:29 PM
RE: Controller Library - by TempodiBasic - 04-13-2023, 09:38 PM
RE: Controller Library - by TerryRitchie - 04-13-2023, 10:28 PM
RE: Controller Library - by OldMoses - 04-16-2023, 04:35 PM
RE: Controller Library - by TerryRitchie - 04-17-2023, 02:07 AM
RE: Controller Library - by OldMoses - 04-17-2023, 11:48 AM
RE: Controller Library - by TerryRitchie - 04-26-2023, 06:23 PM
RE: Controller Library - by TempodiBasic - 05-02-2023, 09:51 AM
RE: Controller Library - by TempodiBasic - 05-13-2023, 11:26 AM
RE: Controller Library - by TerryRitchie - 05-13-2023, 01:35 PM
RE: Controller Library - by TerryRitchie - 05-18-2023, 03:12 AM
RE: Controller Library - by a740g - 09-25-2023, 09:41 PM
RE: Controller Library - by TerryRitchie - 09-26-2023, 02:12 AM



Users browsing this thread: 1 Guest(s)