360 joystick problem

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Lord Tim
Prole
Posts: 30
Joined: Sun Jul 20, 2008 4:07 am

360 joystick problem

Post 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 277 times
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: 360 joystick problem

Post 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.
User avatar
Lord Tim
Prole
Posts: 30
Joined: Sun Jul 20, 2008 4:07 am

Re: 360 joystick problem

Post 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.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: 360 joystick problem

Post by rude »

Ah, of course. Then I don't think it can be done (with SDL).
User avatar
amnesiasoft
Prole
Posts: 12
Joined: Wed Aug 20, 2008 8:59 pm
Location: Denver, Colorado
Contact:

Re: 360 joystick problem

Post 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.
User avatar
Sardtok
Party member
Posts: 108
Joined: Thu Feb 21, 2008 2:37 pm
Location: Norway/Norge/諾威/挪威 (Yes, I'm teh back!)
Contact:

Re: 360 joystick problem

Post 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.
Take off every Zigg for great rapist.
Now, outgay that!
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: 360 joystick problem

Post by rude »

Ok, thanks amnesiasoft and Sardtok. That's good to know.
User avatar
amnesiasoft
Prole
Posts: 12
Joined: Wed Aug 20, 2008 8:59 pm
Location: Denver, Colorado
Contact:

Re: 360 joystick problem

Post 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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], darkfrei, Google [Bot] and 89 guests