Page 1 of 1

Gamepad Button Syntax..?

Posted: Wed Oct 01, 2014 4:43 am
by schmavies
Can someone tell me the code for Xbox game pad button input?

So far, I only know what the D Pad Syntax...

Does anyone know the syntax for the x,y,a,b buttons, the thumb sticks, the shoulder buttons, and the start and back buttons?

Any help would be appreciated! :neko:

Code: Select all

function love.update(dt)
if not joystick then return end

    if joystick:isGamepadDown("dpleft") then
        position.x = position.x - speed * dt
    elseif joystick:isGamepadDown("dpright") then
        position.x = position.x + speed * dt
    end

    if joystick:isGamepadDown("dpup") then
        position.y = position.y - speed * dt
    elseif joystick:isGamepadDown("dpdown") then
        position.y = position.y + speed * dt
    end
end

Re: Gamepad Button Syntax..?

Posted: Wed Oct 01, 2014 4:53 am
by Zilarrezko
Maybe this is what you're looking for.

So I'm guessing just "a" "b" "x" "y" in the isGamepadDown method. Although I've never used the joystick module, neither do I have the means to test them. But take a look at that example there. (Although don't ask me why at the top of the example it says "Use getPosition to help draw a custom mouse image" :|)

Check with this guy
|
|
|
|
|
V

Re: Gamepad Button Syntax..?

Posted: Wed Oct 01, 2014 5:08 pm
by slime
schmavies wrote:Does anyone know the syntax for the x,y,a,b buttons, the thumb sticks, the shoulder buttons, and the start and back buttons?
The gamepad button names are listed here: [wiki]GamepadButton[/wiki] (which is linked from [wiki]love.gamepadpressed[/wiki] and [wiki]Joystick:isGamepadDown[/wiki]), and the gamepad axis names are listed here: [wiki]GamepadAxis[/wiki] (linked from [wiki]Joystick:getGamepadAxis[/wiki].)

Re: Gamepad Button Syntax..?

Posted: Thu Oct 02, 2014 9:25 pm
by schmavies
Thanks a lot for answering. I guess I didn't see that in the LOVE docs... :oops: