xboxlove - Xbox360 Controller module
Posted: Sun Jul 28, 2013 8:02 pm
Hello,
So, xboxlove facilitates the implementation of the xbox360 controller, on Windows and OSX.
You will be able to access, via friendly named constants, the value of each sticks/triggers/buttons of the xbox360 controller.
Left Stick :
xboxlove.Axes.LeftX (>= -1 and <= 1)
xboxlove.Axes.LeftY (>= -1 and <= 1)
xboxlove.Axes.LeftAngle (> -pi and <= pi)
Right Stick :
xboxlove.Axes.RightX (>= -1 and <= 1)
xboxlove.Axes.RightY (>= -1 and <= 1)
xboxlove.Axes.LeftAngle (> -pi and <= pi)
Triggers : (On windows, you can't use both triggers at the same time)
xboxlove.Axes.Triggers (>= -1 and <= 1)
or
xboxlove.Axes.LeftTrigger (>= 0 and <= 1)
xboxlove.Axes.RightTrigger (>= 0 and <= 1)
Dpad : (booleans except Direction)
xboxlove.Dpad.Direction
xboxlove.Dpad.Centered
xboxlove.Dpad.Up
xboxlove.Dpad.Down
xboxlove.Dpad.Right
xboxlove.Dpad.Left
Buttons : (booleans)
xboxlove.Buttons.A
xboxlove.Buttons.B
xboxlove.Buttons.X
xboxlove.Buttons.Y
xboxlove.Buttons.LT
xboxlove.Buttons.RT
xboxlove.Buttons.LB
xboxlove.Buttons.RB
xboxlove.Buttons.Back
xboxlove.Buttons.Start
xboxlove.Buttons.LeftStick
xboxlove.Buttons.RightStick
Methods :
xboxlove:update(dt) (Need to be in love.update)
xboxlove:setJoystick(joystick) (return a boolean)
xboxlove:getJoystick()
xboxlove:setDeadzone(axes,deadzone) (Set a deadzone for one or more axes. (axes(str) can contain "LX","LY","TRIG","TLEFT","TRIGHT","RX","RY" or just "ALL") )
xboxlove:isDown(button) (Use a friendly string ("A","Start",etc) to know if a button is down)
Constructor : xboxlove.create(joystick) (Return a xboxlove object and set the joystick (if omit joystick = 1 and if the joystick doesn't exit or is unplugged return nil) )
Edit :
(Jul 30) I added xboxlove:bind
(Aug 01) Work on OSX ! (with this driver)
(Aug 03) Now the value of the sticks stay between 0 and 1 even with a dead zone, so the angles value is more precise
So, xboxlove facilitates the implementation of the xbox360 controller, on Windows and OSX.
You will be able to access, via friendly named constants, the value of each sticks/triggers/buttons of the xbox360 controller.
Left Stick :
xboxlove.Axes.LeftX (>= -1 and <= 1)
xboxlove.Axes.LeftY (>= -1 and <= 1)
xboxlove.Axes.LeftAngle (> -pi and <= pi)
Right Stick :
xboxlove.Axes.RightX (>= -1 and <= 1)
xboxlove.Axes.RightY (>= -1 and <= 1)
xboxlove.Axes.LeftAngle (> -pi and <= pi)
Triggers : (On windows, you can't use both triggers at the same time)
xboxlove.Axes.Triggers (>= -1 and <= 1)
or
xboxlove.Axes.LeftTrigger (>= 0 and <= 1)
xboxlove.Axes.RightTrigger (>= 0 and <= 1)
Dpad : (booleans except Direction)
xboxlove.Dpad.Direction
xboxlove.Dpad.Centered
xboxlove.Dpad.Up
xboxlove.Dpad.Down
xboxlove.Dpad.Right
xboxlove.Dpad.Left
Buttons : (booleans)
xboxlove.Buttons.A
xboxlove.Buttons.B
xboxlove.Buttons.X
xboxlove.Buttons.Y
xboxlove.Buttons.LT
xboxlove.Buttons.RT
xboxlove.Buttons.LB
xboxlove.Buttons.RB
xboxlove.Buttons.Back
xboxlove.Buttons.Start
xboxlove.Buttons.LeftStick
xboxlove.Buttons.RightStick
Methods :
xboxlove:update(dt) (Need to be in love.update)
xboxlove:setJoystick(joystick) (return a boolean)
xboxlove:getJoystick()
xboxlove:setDeadzone(axes,deadzone) (Set a deadzone for one or more axes. (axes(str) can contain "LX","LY","TRIG","TLEFT","TRIGHT","RX","RY" or just "ALL") )
xboxlove:isDown(button) (Use a friendly string ("A","Start",etc) to know if a button is down)
Constructor : xboxlove.create(joystick) (Return a xboxlove object and set the joystick (if omit joystick = 1 and if the joystick doesn't exit or is unplugged return nil) )
Edit :
(Jul 30) I added xboxlove:bind
(Aug 01) Work on OSX ! (with this driver)
(Aug 03) Now the value of the sticks stay between 0 and 1 even with a dead zone, so the angles value is more precise