A weird issue has popped up with my gamepad implementation:
Gamepad is being detected but none of the inputs are responding at all. This was with an implementation that I had previously had working (And works for Mac just fine). I've paired it down in a separate project to try and debug but it's still not working as expected. This is all the code I have in the secondary project:
System Event:
Draw Event (For testing if inputs are working):
That's it really. I'm seeing the Gamepad type and Slot numbers registering correctly but there's no indication that any inputs are being pressed when they are. This is with a Switch Pro Controller that works just fine for other games on the same computer in Steam.
What's going wrong?
Gamepad is being detected but none of the inputs are responding at all. This was with an implementation that I had previously had working (And works for Mac just fine). I've paired it down in a separate project to try and debug but it's still not working as expected. This is all the code I have in the secondary project:
System Event:
GML:
show_debug_message("Event = " + async_load[? "event_type"]); // Debug cocde so you can see which event has been
show_debug_message("Pad = " + string(async_load[? "pad_index"])); // triggered and the pad associated with it.
switch(async_load[? "event_type"]) // Parse the async_load map to see which event has been triggered
{
case "gamepad discovered": // A game pad has been discovered
var gpad = async_load[? "pad_index"]; // Get the pad index value from the async_load map
gamepad_set_axis_deadzone(gpad, 0.2); // Set the "deadzone" for the axis
gamepad_set_button_threshold(gpad, 0.2); // Set the "threshold" for the triggers
pad_num = gpad
gamepad = true;
break;
case "gamepad lost": // Gamepad has been removed or otherwise disabled
var gpad = async_load[? "pad_index"]; // Get the pad index
pad_num = -1;
gamepad = false
break;
}
GML:
draw_set_font(ariel)
draw_set_color(c_white)
var spacer = 8
var xx = 0;
var yy = 0;
if gamepad
{
draw_text(xx, yy, "Gamepad Slot - " + string(pad_num));
draw_text(xx, yy + spacer*2, "Gamepad Type - " + string(gamepad_get_description(pad_num)));
var lefthaxis = gamepad_axis_value(pad_num, gp_axislh);
var leftvaxis = gamepad_axis_value(pad_num, gp_axislv);
draw_text(xx, yy + spacer*4, "Left H Axis - " + string(lefthaxis));
draw_text(xx, yy + spacer*6, "Left V Axis - " + string(leftvaxis));
draw_text(xx, yy + spacer*8, "Right H Axis - " + string(gamepad_axis_value(pad_num, gp_axisrh)));
draw_text(xx, yy + spacer*10, "Right V Axis - " + string(gamepad_axis_value(pad_num, gp_axisrv)));
draw_text(xx, yy + spacer*12, "R1 - " + string(gamepad_button_value(pad_num, gp_shoulderr)));
draw_text(xx, yy + spacer*14, "R2 - " + string(gamepad_button_value(pad_num, gp_shoulderrb)));
draw_text(xx, yy + spacer*16, "B - " + string(gamepad_button_value(pad_num, gp_face1)));
draw_text(xx, yy + spacer*18, "A - " + string(gamepad_button_value(pad_num, gp_face2)));
draw_text(xx, yy + spacer*20, "Y - " + string(gamepad_button_value(pad_num, gp_face3)));
draw_text(xx, yy + spacer*22, "X - " + string(gamepad_button_value(pad_num, gp_face4)));
draw_text(xx, yy + spacer*24, "Down - " + string(gamepad_button_value(pad_num, gp_padd)));
draw_text(xx, yy + spacer*26, "Left - " + string(gamepad_button_value(pad_num, gp_padl)));
draw_text(xx, yy + spacer*28, "Right - " + string(gamepad_button_value(pad_num, gp_padr)));
draw_text(xx, yy + spacer*30, "Up - " + string(gamepad_button_value(pad_num, gp_padu)));
var hvaxis = abs(lefthaxis) + abs(leftvaxis)
draw_text(xx, yy + spacer*36, "V+H speed - " + string(hvaxis));
}
What's going wrong?