Page 4 of 5

Re: xboxlove - Xbox360 Controller module

Posted: Fri Aug 02, 2013 6:25 am
by Jasoco
slime wrote:The new 0.9.0 Joystick API is not finalized yet. The main repository / builds for 0.9.0 don't have any changes related to SDL 2 in yet, so the Joystick API there is not what it is in the SDL 2 branch (although it's still a tiny bit different from the old 0.8.0, mostly some renamed functions for consistency.)

I think you will be happy with the changes and additions though. :)
I can wait. Especially if Walz is prepared to update. Will be awesome when it's out. I never thought 9 would drop support, but didn't know it wasn't completely replaced yet.

Re: xboxlove - Xbox360 Controller module

Posted: Fri Aug 02, 2013 11:37 am
by Walz.
Jasoco wrote:Pretty darn neato. Very useful. You're amazing.

Could you maybe make a single "xboxlove:init()" function that we could just call easily from the start. I look at the source of your demo.love and I'm not completely sure which code I need and which is just for the app. And I read the methods section and am confused. For now I'll just try and copy what's in the demo, but it's confusing from the start.

I mean it says I just need to use the update function but in your demo you're using other extra code and setting joysticks and deadzones. I just want to plop it into a project and use maybe 2 lines to load and update it. Like what does joystick = 1 mean? Does that mean we can use two or more? How exactly do you go about it? (Not that I have more than one)

Edit: Also, how do I use this on 0.9.0? When I try to run it it says "getNumJoysticks is a nil value". 0.9.0 seems to have changed how Joysticks work. Can one of the 0.9.0 people chime in maybe? I'd loooove to get this working in 9. Maybe we can get this working on both 8 and 9 since 9 is apparently coming soon™*. Should be pretty easy, I just don't know how Joysticks work on 9 let alone 8. So I don't know what to change.

*Valve Time™
I'm not good at commenting my code ... (and love.draw in the demo is a mess)
You can use more than one controller.
Each xboxlove object represent one controller.
Ex :

Code: Select all

function love.load()
    require 'xboxlove'
    player1 = xboxlove.create(1)
    player2 = xboxlove.create(2)

    player1:setDeadzone("all",0.15)
    player2:setDeadzone("all",0.15)
end

function love.update(dt)
    player1:update(dt)
    player2:update(dt)
end
And now you can use player1:isDown("A") or access all the variables like player2.Axes.LeftX (x-axis of the left stick)

Could you help one more time, what name do you get from your Xbox360 controller when you use : love.joystick.getName(1).
On Windows, it's "Controller (XBOX 360 For Windows)". It would help me check if xboxlove is using a xbox360 controller and not an other controller.

(for the 0.9, you just need to change love.joystick.getNumJoysticks() to love.joystick.getJoystickCount())

Re: xboxlove - Xbox360 Controller module

Posted: Sun Aug 04, 2013 7:00 am
by Jasoco
Walz. wrote:Could you help one more time, what name do you get from your Xbox360 controller when you use : love.joystick.getName(1).
On Windows, it's "Controller (XBOX 360 For Windows)". It would help me check if xboxlove is using a xbox360 controller and not an other controller.

(for the 0.9, you just need to change love.joystick.getNumJoysticks() to love.joystick.getJoystickCount())
On OS X it just returns as "Controller".

Also, if that's all I need to do to make it work on 9, I'll try it out. Thanks. I'll let you know shortly how it goes...

Edit: Okay, I now get an error when it gets to the first love.joystick.getAxis() call. Says getAxis is nil.

Re: xboxlove - Xbox360 Controller module

Posted: Sun Aug 04, 2013 10:51 am
by slime
Jasoco wrote:Also, if that's all I need to do to make it work on 9, I'll try it out. Thanks. I'll let you know shortly how it goes...

Edit: Okay, I now get an error when it gets to the first love.joystick.getAxis() call. Says getAxis is nil.
You're using an experimental branch of LÖVE 0.9.0 which has a different Joystick API (among other things), not the official changes...

(also I don't suggest attempting to make things work with the current 0.9.0 Joystick API, as it will change before release.)

Re: xboxlove - Xbox360 Controller module

Posted: Mon Aug 05, 2013 7:09 am
by Jasoco
slime wrote:
Jasoco wrote:Also, if that's all I need to do to make it work on 9, I'll try it out. Thanks. I'll let you know shortly how it goes...

Edit: Okay, I now get an error when it gets to the first love.joystick.getAxis() call. Says getAxis is nil.
You're using an experimental branch of LÖVE 0.9.0 which has a different Joystick API (among other things), not the official changes...

(also I don't suggest attempting to make things work with the current 0.9.0 Joystick API, as it will change before release.)
Is there currently no replacement for getAxis? If so then okie dokie.

Re: xboxlove - Xbox360 Controller module

Posted: Thu Aug 22, 2013 8:00 am
by adnzzzzZ
Thanks for writing this. It was really easy to add to my game!

Re: xboxlove - Xbox360 Controller module

Posted: Fri Oct 18, 2013 11:54 am
by jjmafiae
can use this for my commercial game called 9891? you will get credit.

Re: xboxlove - Xbox360 Controller module

Posted: Mon Dec 16, 2013 5:16 pm
by Jasoco
Now that 0.9.0's finally out with better controller support, anyone willing to tackle updating this library? Or creating a new one?

Re: xboxlove - Xbox360 Controller module

Posted: Mon Dec 16, 2013 5:24 pm
by jjmafiae
i tried updating it, lets just say it didn't end well.....

Re: xboxlove - Xbox360 Controller module

Posted: Mon Dec 16, 2013 6:00 pm
by Ranguna259
Is there really need to update this lib ? Isn't the joystick module pretty stright forward ?
For those that are thinking on creating a new lib keep in mind that the PS4 controller is Plug-and-Play so if someone creates a new lib don't forget to add it's profile.