Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / I have a questions for gamepads control.
- - By cdpro2 Date 2015-06-29 21:46
Sorry about my English.

My Gosu version is 0.9.2 for windows.

I test 4 direction keys for gamepad, however, to operate the on-screen objects but not as I expected.

For example, when I press the Up button object but move down.
When I press the Down button object but move up.
When I press the Left button object but move top left.
When I press the Right button object but move bottom right.

I don't know what happened :(

This is my code and gamepad style.
Parent - By jlnr (dev) Date 2015-06-30 08:37
早安 :) Can you please try if it works with Gosu v0.7.50?

In Gosu 0.8+, I use SDL 2.x to handle all gamepad input. I remember SDL 1.x had a bug with handling some directional pads, maybe it still exists in 2.x? -> In that case we can simply file a bug at the libsdl bug tracker.

Since Gosu 0.8.x+ uses the SDL GameController API to access gamepads, it possible to fix this issue by writing a SDL game controller mapping string for your gamepad:

Maybe this tool is useful to find out the gamepad's GUID etc.; I haven't tried it:

Once you have a mapping string for your gamepad, you can set this environment variable before requiring Gosu:

It probably looks like this:

ENV['SDL_GAMECONTROLLERCONFIG'] = '..........,Sun-Yes USB Gamepad,...........'
require 'gosu'

Hope that helps. I'll make a note to test this myself and write a guide for the Gosu wiki. (....But I usually need a few years to follow up on my notes ;) ).
Up Topic Gosu / Gosu Exchange / I have a questions for gamepads control.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill