USB Gamepads - please help


Author Message
ManiB
Senior Member

Joined: 12/10/2019
Location: Germany
Posts: 141
Posted: 12:04pm 28 Feb 2025      

Ahh i found this...

 Const btn% = Device(Gamepad id%, B)
 Const b$ = str.rpad$(buttons_as_string$(btn%), 40)



Function buttons_as_string$(btn%)
 Local s$
 If btn% And &h01 Then Cat s$, "R, "
 If btn% And &h02 Then Cat s$, "Start, "
 If btn% And &h04 Then Cat s$, "Home, "
 If btn% And &h08 Then Cat s$, "Select, "
 If btn% And &h10 Then Cat s$, "L, "
 If btn% And &h20 Then Cat s$, "Down, "
 If btn% And &h40 Then Cat s$, "Right, "
 If btn% And &h80 Then Cat s$, "Up, "
 If btn% And &h100 Then Cat s$, "Left, "
 If btn% And &h200 Then Cat s$, "ZR, "
 If btn% And &h400 Then Cat s$, "X, "
 If btn% And &h800 Then Cat s$, "A, "
 If btn% And &h1000 Then Cat s$, "Y, "
 If btn% And &h2000 Then Cat s$, "B, "
 If btn% And &h4000 Then Cat s$, "ZL, "
 If Len(s$) Then s$ = Left$(s$, Len(s$) - 2)
 buttons_as_string$ = s$
End Function