I'm a C++ newbie working on adding gamepad support to Moai as a learning exercise and because I'd like to be able to use a gamepad with it. I'm starting by implementing the Xbox 360 gamepad via XInput and that's going pretty well. Eventually I'd also like to support the PS3 gamepad.

This has got me thinking: the 360 and PS3 pads are mostly similar. They have the same number of buttons in more or less the same places that do more or less the same things (e.g., the right trigger on the 360 pad is an analog trigger, so is the R2 trigger on the PS3 pad). From the standpoint of creating an API to support both pads the main difference is the labeling applied to each button.

The PS3 square button is in the same place as the 360 X button, triangle matches Y, circle matches B, and X matches A. Some comparison images:

Xbox 360 Gamepad PS3 Gamepad

When creating the API to work with gamepads I see a couple ways to approach it:

  1. Use the 360 naming conventions exclusively.
  2. Use the PS3 naming conventions exclusively.
  3. Come up with something in between.

I'd like to go with option #3 and could devise my own solution easy enough but don't want to reinvent the wheel unnecessarily.

Is there some standard naming convention used for a gamepad API that supports both 360 and PS3 (and possibly other, similar) gamepads? Is this even really an issue -- should I just create an API, document it and call it good?

  • \$\begingroup\$ I think a lot of APIs just use generic "BUTTON1" sort of names, but really I'd just create an API, document it, and call it good. \$\endgroup\$
    – thedaian
    Feb 28, 2012 at 17:44
  • \$\begingroup\$ like @thedaian said typically they just use "BUTTON0" "BUTTON1" etc and for analog signals "AXIS0" etc. And some APIs also treat POV hat switches (used to be known as "coolie hats") separately but imho the added semantics of exclusionary buttons (no up and down simultaneously) is not worth it and works just as well as buttons. Also fun fact about the PS3 controller: every button exept the "PS", start, select, L3, R3 do send an analog signal in addition to the digital signal. Meaning that they are all pressure sensitive. \$\endgroup\$
    – PeterT
    Feb 28, 2012 at 21:52
  • \$\begingroup\$ @PeterT I seem to remember MGS2 making use of the pressure sensitivity on the PS2. Cool to know that continued on with the PS3. \$\endgroup\$ Feb 28, 2012 at 22:39
  • \$\begingroup\$ I'm going to roll my own API and document it well. One of you should add an answer so I can mark that. \$\endgroup\$ Feb 29, 2012 at 16:48
  • \$\begingroup\$ Just make sure your API has a way to distinguish the controllers. A good game UI is not controller-agnostic at all, but rather is tailored towards the controller being used, and can directly reference the buttons in help text and tutorial popups. Users don't know what "button 3" is but they know what the blue X button is or what the pink square button is. Letting the API abstract is one thing, but make sure I have the ability to determine what the real hardware is so I can customize the UI for the hardware. \$\endgroup\$ Apr 28, 2012 at 0:41

1 Answer 1


What I ended up doing was rolling my own API and documenting it well. In naming buttons I tried to make them both descriptive and controller agnostic.

For example, on the PS3 pad there is a button called R1 that is on the right shoulder. This corresponds with the 360 pad's Right Bumper button. In my API this button is referred to as "Right Shoulder". Where the PS3 has R2, the 360 has Right Trigger and I have Right Trigger as these buttons are analog triggers in both cases. For the face buttons I started where the X/Square buttons (360/PS3) are and counted moving clockwise ending up with Face 1, Face 2, Face 3, Face 4.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .