• 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!

Check joystick/gamepad slot no.

Hi.

Problem: I'm having problems using 2 gamepads on a Windows machine, as Windows keeps switching their slot numbers. Is there a way to control this in GM2 rather than Windows?

Background: I've made an arcade machine and added a laptop running Windows 10, where I have installed a game I've made in GM2. The arcade machine uses two simple USB joysticks as gamepads. Every time I boot up the laptop, Windows switches which gamepad is which. Basically, I have to take out the USB for the player 2 gamepad, start the game, and insert it again. It's not a big deal, but I need to solve this, as I will built more arcade machines and use them for teaching math and programming for kids.

To access my gamepad, I use the following code:
Code:
if gamepad_button_check_pressed(4, gp_face4){

}
 
To add, the main problem is that the start button and sound controls are tied to one of the joysticks. Therefore, if Windows switches the joysticks, and thereby gamepad slot no., the players canoot start the game (or turn down the colume when the kids have been playing with it).
 

TailBit

Member
Code:
gamepad_get_guid
gamepad_get_description
Assign the guid or description to the players, then find the gamepad index using them before fetching the gamepad inputs
 
Top