Page 1 of 1

360 joystick problem

Posted: Fri Sep 26, 2008 7:28 am
by Lord Tim
So I was messing around with the new joystick support, and I've got all the buttons and axis mapped out for my wireless 360 controller, but I notice that it's set up so that the triggers are on the 3rd axis.

Currently, the way it's set up, if you pull the right trigger, the 3rd axis goes from 0 to -1. If you pull the left trigger, the 3rd axis goes from 0 to 1. The problem is, that if you pull both triggers at once, the axis stays at 0, since the 1 and -1 cancel each other out. Because of this, there's no way that I can see to differentiate between the two triggers when they're both being used at the same time.

From what I've seen of other joystick input stuff, the triggers are set to seperate axis, so I'm wondering if you guys could fix that for the next release?

Also, it'd be neat if you could get the rumble packs to be triggerable as well. I haven't seen that as much on PC, though, so perhaps it'd be harder to get working.

Also, also, here's a neat little program I made in löve as an example for the joystick support:
360ControllerDemo.love
360 demo
(138.75 KiB) Downloaded 285 times

Re: 360 joystick problem

Posted: Fri Sep 26, 2008 3:37 pm
by rude
Yeah, I remember the SDL docs state that some controllers use axes 2 and 3 for extra buttons. I'll borrow an Xbox360 controller and see if it's possible to "fake it", i.e. observe the input the controller generates, and somehow create normal button-pushing events from the input.

Rumble: not supported by SDL.

Re: 360 joystick problem

Posted: Fri Sep 26, 2008 5:45 pm
by Lord Tim
Well, it would be nice to still have the triggers as axis, because then you can see how far the trigger is pulled in. But it should be two seperate axis, and not just one.

Re: 360 joystick problem

Posted: Fri Sep 26, 2008 6:30 pm
by rude
Ah, of course. Then I don't think it can be done (with SDL).

Re: 360 joystick problem

Posted: Mon Sep 29, 2008 12:48 am
by amnesiasoft
The only way I know of to differentiate between the axes is either installing the XBCD driver (I think that lets you optionally map the triggers to different axes), or through the XInput API.

Re: 360 joystick problem

Posted: Tue Sep 30, 2008 9:33 am
by Sardtok
Not sure what XBCD or Xinput is, but I'm guessing they somehow relate to DirectX.
As far as I know, and I have a 360 controller, you can only work with them individually in DirectX.
You could use XNA, but it wouldn't be very LÖVEly.
Not even Windows can tell in the control panel that they are separate axes, at least not in XP, maybe in Vista.

Re: 360 joystick problem

Posted: Tue Sep 30, 2008 1:41 pm
by rude
Ok, thanks amnesiasoft and Sardtok. That's good to know.

Re: 360 joystick problem

Posted: Fri Oct 03, 2008 9:30 pm
by amnesiasoft
Sardtok wrote:Not sure what XBCD or Xinput is, but I'm guessing they somehow relate to DirectX.
XBCD is a custom written driver for the xbox 360 controller for Windows. As far as I can tell, the main purpose of it is to let you change the triggers from analog buttons into digital ones so they can be used in more games. Never actually installed it though since I've not had a need for that.

XInput is a part of DirectX. It's an API designed specifically for access to the Xbox 360 controller. It allows you to query the gamepad state, then check if particular buttons were pressed (Instead of Joystick button 0, which could be anywhere on the controller, and likely the user will have no idea which one it is, you can check for the a button instead). It also includes various other features specific to it such as checking battery type, battery level, what type of controller it is (Guitar, Dancepad, Drums, Gamepad, Flight stick, etc...). Basically, it's DirectInput that gives up flexibility in exchange for much greater ease of use.