AppTitle "Keyboard checker"Screen 320,200,2SetBuffer BackBuffer()Global key_down=208,key_up=200,key_left=203,key_right=205,key_btn=29,key_btn1=157,JoyPort=0,JoyButton=1Global Key_ValueCheck[8],Key_Menu$[7]Repeat Key_Change() Delay 100 Cls Color $ff,$ff,$ff Text 1,10,key_up Text 1,20,key_down Text 1,30,key_left Text 1,40,key_right Text 1,50,key_btn Text 1,60,key_btn1 Text 1,70,JoyPort Text 1,80,JoyButton FlushKeys Flip Delay 500 WaitKey() While KeyDown(57) : Delay 1 : Flip : Wend FlushKeysUntil KeyDown(1)Function Key_Change() Local kleft,kup,kright,kdown,kb1,kb2,menu=1,x,y,xloop,menudelay=MilliSecs(),s,t,duplicate=0,quit,J_Btn SetBuffer BackBuffer() Key_Menu[1]="Up" Key_Menu[2]="Down" Key_Menu[3]="Left" Key_Menu[4]="Right" Key_Menu[5]="Btn1" Key_Menu[6]="Btn2" Key_Menu[7]="Joy Port:Btn" Key_ValueCheck[1]=key_up Key_ValueCheck[2]=key_down Key_ValueCheck[3]=key_left Key_ValueCheck[4]=key_right Key_ValueCheck[5]=key_btn Key_ValueCheck[6]=key_btn1 Key_ValueCheck[7]=JoyPort Key_ValueCheck[8]=JoyButton quit=0 Repeat Cls Color $ff,$ff,$ff Line 0,30,320,30 Line 0,170,320,170 Text 1,2,"Change the Keyboard Bindings" Text 55,14,"(Arrow Up+Down, Return to select)" Text 1,170,"Press esc to return without saving" If duplicate=0 Text 1,183,"Press space to save and exit" Else Text 1,183,"The bindings won't be saved!" EndIf Text 120,33,"Key Name Value" Color $ff,$ff,0 Line 120,45,272,45 Line 120,150,272,150 If duplicate>0 Then Color $ff,0,0 : Text 120,155,"Duplicate found" If KeyDown(208) And MilliSecs()-menudelay>250 Then menu=menu+(menu<7) : menudelay=MilliSecs() If KeyDown(200) And MilliSecs()-menudelay>250 Then menu=menu-(menu>1) : menudelay=MilliSecs() For xloop=1 To 7 Color $ff,$ff,$ff If BitState(duplicate,xloop)=1 Then Color $ff,0,0 If xloop=menu Color $0,$ff,$0 If BitState(duplicate,xloop)=1 Then Color $00,$80,$00 EndIf If xloop<7 Text 120,32+(15*xloop),LSet(Key_Menu[xloop],12)+" = "+Key_ValueCheck[xloop] Else Text 120,32+(15*xloop),LSet(Key_Menu[xloop],12)+" = "+Key_ValueCheck[7]+":"+Key_ValueCheck[8] EndIf Next kup=KeyDown(Key_ValueCheck[1]) Or (JoyHat(Key_ValueCheck[7])=0) kdown=KeyDown(Key_ValueCheck[2]) Or (JoyHat(Key_ValueCheck[7])=180) kleft=KeyDown(Key_ValueCheck[3]) Or (JoyHat(Key_ValueCheck[7])=270) kright=KeyDown(Key_ValueCheck[4]) Or (JoyHat(Key_ValueCheck[7])=90) J_Btn=JoyDown(Key_ValueCheck[8],Key_ValueCheck[7]) kb1=KeyDown(Key_ValueCheck[5]) Or J_Btn kb2=KeyDown(Key_ValueCheck[6]) Or J_Btn Color $ff,$ff,$ff Rect 10,80,30,30,kleft ;Left Rect 40,50,30,30,kup ;Up Rect 70,80,30,30,kright ;Right Rect 40,110,30,30,kdown ;Down Oval 75,40,30,30,kb1 ;B1 Oval 75,120,30,30,kb2 ;B1a If KeyDown(28) If menu<7 Then While KeyDown(28): Delay 1 : Flip : Wend : FlushKeys : Goto Getthekey If menu=7 Then Goto getthejoypadbtn EndIf .back Flip (1) Delay 1 If KeyDown(1) Then quit=1 ;Esc If KeyDown(57) Then quit=2 ;Space Until quit>0 If duplicate>0 Then quit=1 If quit=1 Then While KeyDown(1):Delay 1:Flip:Wend: Return If quit=2 Then While KeyDown(57):Delay 1:Flip:Wend Goto setthekeysback ;Exit of the function .Getthekey Color $ff,$ff,$ff s=0 menudelay=MilliSecs() Repeat ;Keyboard routine Cls t=Int((MilliSecs()-menudelay)*0.001) Text 0,0,"Press the desired key for " Text 0,20,">"+Key_Menu[menu]+"<" Text 0,40,"Returning at 10 : "+(t) For x=1 To 255 If KeyDown(1)=1 Then s=1 If x>1 And KeyDown(x)=1 Then While KeyDown(x) : Delay 1 : Wend : Key_ValueCheck[menu]=x : s=1 : Exit Next Flip Until s=1 Or t=>10 While KeyDown(1) : Delay 1 : Flip : Wend : FlushKeys menudelay=MilliSecs() duplicate=0 For x=1 To 6 ;Duplicate checker For y=1 To 6 If x<>y If Key_ValueCheck[x]=Key_ValueCheck[y] Then duplicate=BitSet(duplicate,y) EndIf Next Next Goto back .getthejoypadbtn s=0 menudelay=MilliSecs() Repeat ;Joypad routine Cls t=Int((MilliSecs()-menudelay)*0.001) Text 0,0,"Press the Jump button on your joypad " Text 0,40,"Returning at 10 : "+(t) For x=0 To 10 ;Joystick Port number For y=0 To 20 ;Joystick buttons If KeyDown(1)=1 Then s=1 If JoyDown(y)<>0 Then While JoyDown(y)<>0 : Delay 1 : Wend : Key_ValueCheck[7]=x :Key_ValueCheck[8]=y: s=1 : Exit Next Next Flip Until s=1 Or t=>10 While KeyDown(1) : Delay 1 : Flip : Wend : FlushKeys menudelay=MilliSecs() Goto back .setthekeysback key_up=Key_ValueCheck[1] key_down=Key_ValueCheck[2] key_left=Key_ValueCheck[3] key_right=Key_ValueCheck[4] key_btn=Key_ValueCheck[5] key_btn1=Key_ValueCheck[6] JoyPort=Key_ValueCheck[7] JoyButton=Key_ValueCheck[8]End FunctionFunction Screen(x,y,zoom#=1) If x<64 Then x=64 If y<64 Then y=64 bits=32 Graphics x*zoom,y*zoom,bits,2 Graphics x,y,bits,3End FunctionFunction BitState(a,b);a = variable;b = bit number to Check (1 is the 1st bit) Return Mid(Bin$(a),Len(Bin$(a))-(b-1),1)End FunctionFunction BitSet(a,b) Local y,x;a = variable;b = bit number to set (reminder: bit #1 is the rightmost bit: %101001110[1] <- ) y=1 For x=0 To b If x<=1 y=x Else y=y*2 EndIf Next Return y Or aEnd Function
Does it use the analogs? What joy commands are you using to detect them? I think joyx and joyy cover one stick and joyhat the other. On my ps pad left stick is joyx and joyy but right is joy roll and joyu or something like that. You should be ok using joyx and joyy on any pad but not joyhat.
Seems to be a Xinput issue. Would you be so kind and test, if you get any controller response with the program I am supplying in my attachment?
Graphics 1920,1080,32,1SetBuffer BackBuffer() ;XBox 360 controller library for Blitz3D by Earok (Earok.Net);I declare this code to be in the public domain;This library provides complete XBox 360 controller support except for the following limitations:;1. No force feedback support;2. Left and Right triggers cancel each other out. Holding them both down is the same as holding neither down.;3. No support for the center glowing button;Constants defining every XBox 360 button, just pass these to the standard joyhit, joydown functions etc.Const x360_button_a = 1Const x360_button_b = 2Const x360_button_x = 3Const x360_button_y = 4Const x360_button_lb = 5Const x360_button_rb = 6Const x360_button_back = 7Const x360_button_start = 8Const x360_button_lts = 9Const x360_button_rts = 10;Uncomment the next line to run an example controller applicationDemoProgram();;This trims out small values from not quite centered analogue sticks and triggers. You don't need to call this from your game. ;Alter trim value to adjust the "dead zone" from the stick/trigger center.Const x360_trim_value# = 0.20Function x360_Trim#(value#) If(Abs(value#) > x360_trim_value#) Return value# End Function;Returns the left trigger valueFunction x360_LTrigger#(port=0) If (JoyZ(port) > x360_trim_value#) Return x360_Trim#(JoyZ(port)) End Function;Returns the right trigger valueFunction x360_RTrigger#(port=0) If JoyZ(port) < (0 - x360_trim_value) Return x360_Trim#(JoyZ(port)) * -1 End Function;Returns the X value on the D-PadFunction x360_DPadX(port=0) If JoyHat(port) > -1 Then Return x360_Trim#(Sin(JoyHat(port))) End Function;Returns the Y value on the D-PadFunction x360_DPadY(port=0) If JoyHat(port) > -1 Then Return -x360_Trim#(Cos(JoyHat(port))) End Function;Returns the X value on the Left ThumbstickFunction x360_LeftStickX#(port=0) Return x360_Trim#(JoyX(port)) End Function;Returns the Y value on the Left ThumbstickFunction x360_LeftStickY#(port=0) Return x360_Trim#(JoyY(port)) End Function;Returns the X value on the Right ThumbstickFunction x360_RightStickX#(port=0) Return x360_Trim#(Sin(JoyPitch(port) / 2)) End Function;Returns the Y value on the Right ThumbstickFunction x360_RightStickY#(port=0) Return x360_Trim#(Sin(JoyYaw(port) / 2)) End Function;Demo application For Xbox 360 controller supportFunction DemoProgram() Local ButtonDefs$[11] ButtonDefs[0] = "None" ButtonDefs[1] = "A" ButtonDefs[2] = "B" ButtonDefs[3] = "X" ButtonDefs[4] = "Y" ButtonDefs[5] = "Left Shoulder" ButtonDefs[6] = "Right Shoulder" ButtonDefs[7] = "Back" ButtonDefs[8] = "Start" ButtonDefs[9] = "Left Thumbstick" ButtonDefs[10] = "Right Thumbstick" While Not KeyHit(1) Cls() Text 0,00,"Stick Left X: " + x360_LeftStickX() Text 0,20,"Stick Left Y: " + x360_LeftStickY() Text 0,40,"Stick Right X: " + x360_RightStickX() Text 0,60,"Stick Right Y: " + x360_RightStickY() Text 0,80,"Left Trigger: " + x360_LTrigger() Text 0,100,"Right Trigger: " + x360_RTrigger() Text 0,120,"DPad X: " + x360_DPadX() Text 0,140,"DPad Y: " + x360_DPadY() lastpressed = GetJoy() If lastpressed > 0 Then press = lastpressed Text 0,160,"Button Pressed: " + ButtonDefs[press] Text 0,200,"Press Escape to quit" Flip() Wend EndGraphics End End Function
I'v got an PDP Wired Xbox one controller.The controler is not working in this game. (At first it did, but then i realized that the "Antimicro joy2key" was running, which i use to run older not compatible games with the controller)If you like, i have here an program, which i used for another project, to set up the keyboard/joypad keys, and it is working with my joypad:It would be nice, if you could compile it with your bb version and upload it.
Ok, i'v attached the compiled version of the code. It works here, but your compiled version does not.The Keyboard Checker does not work here, it shows the up key as being always pressed.I guess it is up to the blitzbasic version ...
While Not KeyHit(1)jyaw#=JoyYaw()jpitch#=JoyPitch()ClsText 0,0,"Joy X Direction: " + JoyXDir() + " Y= " + JoyYDir() Text 0,10,"Joy X Value: " + JoyX() + " - Joy Y Value:" + JoyY()Text 0,20,"Joy Z Value: " + JoyZ()Text 0,30,"Joy Hat: " +JoyHat() Text 0,40,"JoyYaw(): "+jyaw#Text 0,50,"JoyPitch(): "+jpitch#Wend
If p1_use_gamepad = True Then Select JoyType(0) Case 0 p1_use_gamepad = False p2_use_gamepad = False p1_gamepad_connected = False p2_gamepad_connected = False Case 1,2 Select JoyType(1) Case 0 p2_use_gamepad = False p2_gamepad_connected = False p1_gamepad_connected = True; DebugLog "NO JOYSTICK ON PORT 1! PLAYER 2 USE KEYBOARD!" Case 1,2 p2_use_gamepad = True p1_gamepad_connected = True p2_gamepad_connected = True; DebugLog "JOYSTICK ON PORT 1! ALL PLAYERS USE GAMEPAD!" End Select End Select End If