• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Linux Gamepad detected, not working.

Hello all.

I've a Dragonrise-based arcade stick hooked up to my Linux machine. I can see the joystick listed as js0. I can test it with the HTML5 joystick site.

GameMaker sees it in the terminal output.

GameMaker refuses to read input from the joystick.

I'm completely flummoxed. It won't read the axis or the buttons.

Has anyone experienced this and found a way to correct it?
 
How are you detecting and accessing the controller in GMS?
So. I've made some progress but am still having some issues. I was able to find which input port I was hanging out on by using:

var gp_num = gamepad_get_device_count();
for (var i = 0; i < gp_num; i++;)
{
if gamepad_is_connected(i) global.gp = true else global.gp = false;
}


I figured out my initial problem was that I was actually using input number 15. So, I fixed that. However, the issue I'm having now is that my vertical axis doesn't read.

if (gamepad_axis_value(15, gp_axislh) < 0)
{

self.x--;
}

if (gamepad_axis_value(15, gp_axislv) > 0)
{

self.y++;
}


The horizontal axis works fine. The vertical does not. The Ubuntu machine can read the axis with the joystick calibration tool but I'm having a trial trying to figure out how to read it.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
I figured out my initial problem was that I was actually using input number 15. So, I fixed that. However, the issue I'm having now is that my vertical axis doesn't read.
if (gamepad_axis_value(15, gp_axislh) < 0)
Still using 15 in the code (which seems a high number as there are only 12 available gamepad slots numbered from 0 - 11).

That said, use the Async event to detect the gamepad, that way you don't need any of the code you have above. Also, don't hard-code your gamepad number, as it can change as pads are connected/disconnected. See this tech blog for more details (it's for 1.4 but still relevant for GMS2): https://www.yoyogames.com/blog/75/how-to-setup-and-use-gamepads

The Draw event "for" loop in that article only checks up to four, but it should check up to 12. Other than that it should all work fine.
 
Top