SDL Platform Gamepad Controller Buttons Needs Fix

Reporter: mikeypro83  |  Status: open  |  Last Modified: November 17, 2020, 03:06:10 PM

Ubuntu 20.xx
SDL Platform
Gamepad is an iNNEXT SNES style gamepad that tests 100% working and correct in jstest-gtk

Because of the way SDL does buttons and the way you guys have implemented buttons to line up with the gp_ constants, I propose a change when checking the range of buttons.

I propose the extent be changed from enigma_user::gp_padr to enigma_user::gp_empty and to either use a less than or greater than or equal to comparison for the in range and out of range checks, respectively.

I have had to make this change in my implementation so that my controller reports gp_none when there are no buttons being pressed. Otherwise it was reporting a constant button press because the SDL event handler takes the SDL button number and puts it into the button state array expecting the values to line up, im sure it was a range issue. :) :) Unfortunately that caused a conflict which I couldn't figure out exactly but I was able to resolve it by increasing the range of the button state arrays and the checks to a max range of gp_empty-1. I would also suggest moving gp_empty to at least 30 to be 1,000% sure all possible buttons have room and anything after the last gp_ button constant before gp_empty be named gp_b(N) up to gp_empty. it doesn't change gamemaker compatability but it extends the capability of enigma's gamepad support while still supporting gamemakers IMO lame and frustrating gamepad implementation. I have Studio 2 and while it is awesome in almost every aspect, programming the input system sucks because gamepad implementation is poorly realized/designed and difficult to work with. It's one aspect of gamemaker that has been really weak and needs love and I figure this would help a lot of people as well.

I say this not knowing how hardcore you guys are to an exact gamemaker implementation copy, even if it sucks. :)

This is indeed an issue that should be fixed, even the following doesn't work for me with the Xbox 360 controller.
draw_text(0,0,string(gamepad_button_check(0, gp_padr)));

@mikeypro83 can you test #2165 and let me know please?
Please sign in to post comments, or you can view this issue on GitHub.