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 » Fri Sep 26, 2008 7:28 am

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 161 times

User avatar
rude
Administrator
Posts: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: 360 joystick problem

Post by rude » Fri Sep 26, 2008 3:37 pm

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 » Fri Sep 26, 2008 5:45 pm

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: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: 360 joystick problem

Post by rude » Fri Sep 26, 2008 6:30 pm

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 » Mon Sep 29, 2008 12:48 am

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 » Tue Sep 30, 2008 9:33 am

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: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: 360 joystick problem

Post by rude » Tue Sep 30, 2008 1:41 pm

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 » Fri Oct 03, 2008 9:30 pm

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: steVeRoll, zorg and 16 guests