Restored from previous forum. Originally posted by Rings.
Easy codesnippet to retrieve Joystickinfo
(you don't need any DirectX lib's)
Code: Select all
; Get Joystick info without using DirectX
; written by Siegried Rings April,4th, 2002
; using winmm.dll, only Windows!
; good if you want to measure something
; (0-5 Volt) with the analog gameport
joy.JOYINFO
joyID = 0
If OpenWindow(0, 100, 120, 300, 200, "Joystick Native Windows-API",
#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(0, 20, 25, 200, 20, "")
Repeat
EventID = WaitWindowEvent()
Delay(5)
Result = joyGetPos_(joyId, joy)
SetGadgetText(0, "JoyInfo: " + Str(joy\wXpos) + ":" + Str(joy\wYpos) + ":" +
Str(joy\wZpos) + ":" + Str(joy\wButtons))
Until EventID = #PB_Event_CloseWindow
EndIf