Gamepad Button Syntax..?

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
schmavies
Prole
Posts: 5
Joined: Fri Apr 11, 2014 10:55 pm
Location: The Gamma Planetary System, the 58th Planet.

Gamepad Button Syntax..?

Post 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
"640K ought to be enough for anybody."
- Bill Gates
User avatar
Zilarrezko
Party member
Posts: 345
Joined: Mon Dec 10, 2012 5:50 am
Location: Oregon

Re: Gamepad Button Syntax..?

Post 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
Last edited by Zilarrezko on Wed Oct 01, 2014 7:32 pm, edited 1 time in total.
User avatar
slime
Solid Snayke
Posts: 3162
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Gamepad Button Syntax..?

Post 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].)
User avatar
schmavies
Prole
Posts: 5
Joined: Fri Apr 11, 2014 10:55 pm
Location: The Gamma Planetary System, the 58th Planet.

Re: Gamepad Button Syntax..?

Post by schmavies »

Thanks a lot for answering. I guess I didn't see that in the LOVE docs... :oops:
"640K ought to be enough for anybody."
- Bill Gates
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests