2014-03-16, 16:27
I have got a lot of messages how to programm the Guidebutton. Here I will show you how it works ! Put it in your own Code and have fun ! Its very simple written in Purebasic ! It was difficult to get the information for me.
My Programm (xbmcwatcher) and Guidecall are working like this code.
#XINPUT_GAMEPAD_GUIDE = $0400 ;Der Guidebutton !!
#DLLDatei = "xinput1_3.dll"
Structure XINPUT_GAMEPAD
wButtons.w
bLeftTrigger.b
bRightTrigger.b
sThumbLX.w
sThumbLY.w
sThumbRX.w
sThumbRY.w
EndStructure
Prototype guidbutton(UserIndex.l, *pState.XINPUT_GAMEPAD)
Procedure Guidebutton()
;ermittelt ob der Guidbutton (der Knopf in der Mitte) gedrückt wurde !
Protected xinput, getguidbutton.guidbutton, x_struct.XINPUT_GAMEPAD
xinput = OpenLibrary (#PB_Any, #DLLDatei)
If xinput
getguidbutton = GetFunctionEntry(xinput, 100)
getguidbutton(0, @x_struct)
CloseLibrary (xinput)
If x_struct\wbuttons = #XINPUT_GAMEPAD_GUIDE
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndIf
ProcedureReturn #False
EndProcedure
;....thats all ...now you can return the state of the Guidebutton
My Programm (xbmcwatcher) and Guidecall are working like this code.
#XINPUT_GAMEPAD_GUIDE = $0400 ;Der Guidebutton !!
#DLLDatei = "xinput1_3.dll"
Structure XINPUT_GAMEPAD
wButtons.w
bLeftTrigger.b
bRightTrigger.b
sThumbLX.w
sThumbLY.w
sThumbRX.w
sThumbRY.w
EndStructure
Prototype guidbutton(UserIndex.l, *pState.XINPUT_GAMEPAD)
Procedure Guidebutton()
;ermittelt ob der Guidbutton (der Knopf in der Mitte) gedrückt wurde !
Protected xinput, getguidbutton.guidbutton, x_struct.XINPUT_GAMEPAD
xinput = OpenLibrary (#PB_Any, #DLLDatei)
If xinput
getguidbutton = GetFunctionEntry(xinput, 100)
getguidbutton(0, @x_struct)
CloseLibrary (xinput)
If x_struct\wbuttons = #XINPUT_GAMEPAD_GUIDE
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndIf
ProcedureReturn #False
EndProcedure
;....thats all ...now you can return the state of the Guidebutton