• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

XBOX360 shoulder buttons/axes

kburkhart84

Firehammer Games
I'm working on my kbinput extension...I'm seeing that the gp_shoulderlb and gp_shoulderrb axes are actually set up as buttons in GMS's input code. I had it understood that these are axes, not just buttons. If I try to use that constant with the axis checking function, it instead checks the left horizontal axis for the left shoulder button/axis. But when I check the buttons, I get a good 0/1 value for the button.

So, is there something I'm missing, or something GMS isn't doing right? I was expecting to get a decimal value between 0 and 1 depending on how far those buttons are depressed(they are axes after all). In the windows control panel, it has them combined as a single Z axis, where pushing the left makes it go positive and pushing the right makes it go negative, which is actually the behavior that happens when using DInput instead of XInput for these gamepads.
 

kburkhart84

Firehammer Games
Exactly, but it is the triggers that are not working as analog, rather as if they were simply buttons and not analog axes.
 

kburkhart84

Firehammer Games
Yeah, I thought I had that stuff working right when I coded the previous version of my kbinput thingy...it has been so long though so I wasn't sure. Thanks for the help testing...maybe they will fix it.

[edit]

I actually outputted the values of the constants at first, and the gp_shoulderlb has a different value than the one for the horizontal left axis, even though when you use the gp_shoulderlb constant in the axis checking function it checks the left horizontal axis.

I didn't do any more testing on the right side, or the constants at that point though, as I had in my head the idea that these things were instead being counted as buttons for whatever reason.
 
Last edited:

kburkhart84

Firehammer Games
Yes, they all were reading that same axis for whatever reason. Also, I saw that ninja edit and mentioned about the constants I tested as well.
 
I

InfraGhosts

Guest
If anyone sees this the problem is using "gamepad_axis_value()" will not work with button pushes or triggers. Try "gamepad_button_value()" for triggers and "gamepad_button_check()" for buttons. Put this in an object and put it in you room and see how you go:

refNum = 0 // Your controller number 0-3 for xinput 4-7 for directInput
axislh = gamepad_axis_value(refNum, gp_axislh); // Left xAxis
axislv = gamepad_axis_value(refNum, gp_axislv); // Left yAxis
axisrh = gamepad_axis_value(refNum, gp_axisrh); // Right xAxis
axisrv = gamepad_axis_value(refNum, gp_axisrv); // Right yAxis
shoulderlb = gamepad_button_value(refNum, gp_shoulderlb); // Left Trigger
shoulderrb = gamepad_button_value(refNum, gp_shoulderrb); // Right Trigger
face1 = gamepad_button_check(refNum, gp_face1); // A
face2 = gamepad_button_check(refNum, gp_face2); // B
face3 = gamepad_button_check(refNum, gp_face3); // X
face4 = gamepad_button_check(refNum, gp_face4); // Y
shoulderl = gamepad_button_check(refNum, gp_shoulderl); // Left Bumper
shoulderr = gamepad_button_check(refNum, gp_shoulderr); // Right Bumper
select = gamepad_button_check(refNum, gp_select); // Select
start = gamepad_button_check(refNum, gp_start); // Start
stickl = gamepad_button_check(refNum, gp_stickl); // Left Stick Down
stickr = gamepad_button_check(refNum, gp_stickr); // Right Stick Down
padu = gamepad_button_check(refNum, gp_padu); // Pad Up
padd = gamepad_button_check(refNum, gp_padd); // Pad Down
padl = gamepad_button_check(refNum, gp_padl); // Pad Right
padr = gamepad_button_check(refNum, gp_padr); // Pad Left

draw_text_transformed(
x, y, "MidiRad Triggers \n"
+ "\nLeft X=" + string(axislh)
+ "\nLeft Y=" + string(axislv)
+ "\nRight X=" + string(axisrh)
+ "\nRight Y=" + string(axisrv)
+ "\nLeft Slider=" + string(shoulderlb)
+ "\nRight Slider=" + string(shoulderrb)
+ "\nA=" + string(face1)
+ "\nB=" + string(face2)
+ "\nX=" + string(face3)
+ "\nY=" + string(face4)
+ "\nLButton=" + string(shoulderl)
+ "\nRButton=" + string(shoulderr)
+ "\nSelect=" + string(select)
+ "\nStart=" + string(start)
+ "\nStickL=" + string(stickl)
+ "\nStickR=" + string(stickr)
+ "\nUp=" + string(padu)
+ "\nRight=" + string(padr)
+ "\nDown=" + string(padd)
+ "\nLeft=" + string(padl)
,1 ,1 ,0);
 
Top