xboxlove - Xbox360 Controller module

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Innocuous
Prole
Posts: 13
Joined: Thu Jul 11, 2013 12:09 pm

Re: xboxlove - Xbox360 Controller module

Post by Innocuous »

Thank you, a very useful module!
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: xboxlove - Xbox360 Controller module

Post by Jasoco »

Hmm, doesn't work right for me on OS X using the "Xbox 360 Controller Driver". All the buttons return the wrong values.

For instance:
The right stick doesn't work right at all (Well, it does.. but it doesn't... When idle, right stick is at -178deg, When moving up or down it activates the Left and Right triggers for some reason, also there's a red line between both sticks that moves up and down when I tilt it left or right.)
Left stick works fine
D-Pad returns the X, Y, A and B buttons (Right = Y, Left = X, Up = A, Down = B)
Clicking the sticks does Back (Left stick) and Start (Right stick) instead
Start and Back do Left and Right Bumpers respectively
The bumpers do the left and right Sticks respectively
Triggers do nothing (Actually, the left trigger will make the right stick change from ~-180deg to ~0deg)
Neither does pressing A, B, X and Y
Nothing at all makes the D-Pad light up

If you need me to help figure out how to get it working, I will do my best, but the above is a list of all the problems.

Kinda sad. But hopefully you can fix it. I'd love to start implementing Xbox controller support into my game.

I made a useless video to help you out!

User avatar
Innocuous
Prole
Posts: 13
Joined: Thu Jul 11, 2013 12:09 pm

Re: xboxlove - Xbox360 Controller module

Post by Innocuous »

Just to make sure, your controller does work correctly with other games?
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: xboxlove - Xbox360 Controller module

Post by Jasoco »

Innocuous wrote:Just to make sure, your controller does work correctly with other games?
Yes. And the .love file works fine in Windows. (All buttons seem to be correct if I run the .love under Windows)

I can tell it's being recognized by OS X correctly because of the driver's Preferences window itself:
Screen Shot 2013-07-29 at 6.26.52 AM.png
Screen Shot 2013-07-29 at 6.26.52 AM.png (82.52 KiB) Viewed 5740 times
All buttons show correctly in there. Only this .love is reporting them incorrectly.

Can someone else with OS X please try this out? (You'll need to install the OS X 360 driver since OS X doesn't have native support)
User avatar
Walz.
Prole
Posts: 13
Joined: Mon May 06, 2013 2:42 pm

Re: xboxlove - Xbox360 Controller module

Post by Walz. »

It's look like that, on Mac, the axes are shuffled and the Dpad is recognize as buttons.
Run the .love linked, it's will show how the controller is mapped.
Attachments
joystick.love
(542 Bytes) Downloaded 172 times
User avatar
Walz.
Prole
Posts: 13
Joined: Mon May 06, 2013 2:42 pm

Re: xboxlove - Xbox360 Controller module

Post by Walz. »

I added a method to bind a function to an input.
Edit : It wasn't a really good idea this function
Last edited by Walz. on Sat Aug 03, 2013 10:43 am, edited 2 times in total.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: xboxlove - Xbox360 Controller module

Post by josefnpat »

getting the xbox360 controller to work on multiple platforms (especially since we don't have SDL2 yet) is a huge hassle, especially when it comes to windows.

If you're interested, check out my dong library: github.com/josefnpat/dong
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: xboxlove - Xbox360 Controller module

Post by raidho36 »

josefnpat, this script is great, actually. I'm gonna borrow axis and buttons mapping from it to use by default for XBox360 mode in my lib.

EDIT: I tried to run the whole thing and, sadly, it doesn't work. It is, in fact, throws an error while throwing an error. Tried all configurations to no avail, goes with the same error, saying that .dll is corrupted or something, while LÖVE throws an error about invalid UTF-8.
Last edited by raidho36 on Wed Jul 31, 2013 11:05 am, edited 1 time in total.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: xboxlove - Xbox360 Controller module

Post by Jasoco »

Too bad they can't just build official support into 0.9.0. That way it can be sure to work on all three OS'. Imagine also being able to access the vibration feature.
Walz. wrote:It's look like that, on Mac, the axes are shuffled and the Dpad is recognize as buttons.
Run the .love linked, it's will show how the controller is mapped.
Okay. If this helps, here's my findings:

Axis:
1 = Left stick Left and Right
2 = Left stick Up and Down
3 = Right stick Left and Right
4 = Right stick Up and Down
5 = Left trigger
6 = Right trigger

Buttons:
1 = D-Pad Up
2 = D-Pad Down
3 = D-Pad Left
4 = D-Pad Right
5 = Start button
6 = Back button
7 = Left stick Click
8 = Right stick Click
9 = Left bumper
10 = Right bumper
11 = Xbox logo
12 = A button (Green)
13 = B button (Red)
14 = X button (Blue)
15 = Y button (Yellow)


On Windows though it's a bit different...
Axes:
1 = Left stick Left and Right
2 = Left stick Up and Down
3 = Left and Right trigger (Instead of each trigger being a separate axis with -1 being off and 1 being on, both share one trigger with 1 being left and -1 being right and 0 being neither. If both triggers are pressed the value is 0.)
4 = Right stick Up and Down
5 = Right stick Left and Right (Note the directions are reverse order for the right stick)

Buttons:
1 = A button
2 = B button
3 = X button
4 = Y button
5 = Left bumper
6 = Right bumper
7 = Back
8 = Start
9 = Left stick Click
10 = Right stick Click

Hats:
1 = D-Pad (It shows "c" when no direction is pressed and "l", "r", "u" and "d" when one is. And if two are pressed it does both letters.)

Note: Windows doesn't let me use the Xbox logo button but OS X does. So Windows reports one button less than OS X with 4 of them being on one input. And one less joystick with two sticks being merged into one. This is while using the Tattieboogie Xbox Controller driver on OS X (The closest we can get to official) and the built-in official MS 360 driver on Windows. Personally I prefer the way OS X handles it. Each thing gets its own input and it even lets me use the Dashboard button which could be useful if it were supported across the board.

Hopefully this helps you maybe implement official detection of the OS and proper support for the library. I'd love to use it worry free in my game. I just wish the two triggers weren't merged on Windows. What if I need to use both of them? Hypothetically of course. You can't because either you use the left or the right. Trying to use both ends up canceling each other out.

Also... what are Balls? I only learned what Hats were when I plugged it into Windows. But Balls doesn't show for either OS for me. (Trackballs?)
User avatar
Walz.
Prole
Posts: 13
Joined: Mon May 06, 2013 2:42 pm

Re: xboxlove - Xbox360 Controller module

Post by Walz. »

Thanks you !

I think ball are for this kind of controllers :
Image

I don't know either, why we can't use both triggers on windows...
I thinks, I gonna add the home button (even if it will be unusable on windows) and stay with one value for the triggers (sadly...).

Edit : Now it's should work but i can't test it.
The Home button work on mac but doesn't on windows and the triggers should work the same way on windows and OSX.
Attachments
test.love
(23.12 KiB) Downloaded 159 times
Last edited by Walz. on Wed Jul 31, 2013 5:12 pm, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests