# Joystick Axis/Button names

**URL:** <https://discourse.glfw.org/t/joystick-axis-button-names/735>\
**Category:** support\
**Created:** [August 19, 2016, 9:15am UTC](https://discourse.glfw.org/t/joystick-axis-button-names/735 "2016-08-19T09:15:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtsamis](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@mtsamis](https://discourse.glfw.org/u/mtsamis)\
**Post date:** [August 19, 2016, 9:15am UTC](https://discourse.glfw.org/t/joystick-axis-button-names/735/1 "2016-08-19T09:15:43Z")

</div>

Hi everyone,

I’m making a program in which I would like to include support for joysticks/controllers and since I’m using glfw for it I was looking to implement it with the methods provided by glfw. Every of the provided methods do work as intended (axis/button polling, joystick name) but it seems there is nothing to obtain Axis/Button names. When binding joystick buttons to actions in the settings screen, I’m searching for a way to obtain a name for the pressed button in order to display it to the user (instead of displaying button 1, button 2…). Is there any way to do this with glfw?

Thanks

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [August 19, 2016, 9:42am UTC](https://discourse.glfw.org/t/joystick-axis-button-names/735/2 "2016-08-19T09:42:10Z")

</div>

There’s no direct method for doing this. You could [get the joystick name](http://www.glfw.org/docs/latest/input_guide.html#joystick_name) and then use that to determine the controller type and use a table similar to [this one for Xbox 360 controller](http://wiki.unity3d.com/index.php?title=Xbox360Controller), or let users name their buttons. The [Xbox 360 controller names are set here](https://github.com/glfw/glfw/blob/f48b63de38ba72c6b63825c0ae2bb355d8716ec3/src/win32_joystick.c#L152-L154) for example.

This has always been a tricky issue in PC development - I’m not aware of a general approach to solving this. XInput on PC does specify the names of inputs but that’s only one of many APIs GLFW sits on.

Note: for reference see [the documentation for Joystick/controllers](http://www.glfw.org/docs/latest/input_guide.html#joystick).

---

<div class="post-metadata">

**Author:** ![mtsamis](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@mtsamis](https://discourse.glfw.org/u/mtsamis)\
**Post date:** [August 19, 2016, 10:12am UTC](https://discourse.glfw.org/t/joystick-axis-button-names/735/3 "2016-08-19T10:12:27Z")

</div>

Thanks for the fast reply!

I see. The “xbox 360 controller names” page was helpful, I guess I can use button names for xbox360 controllers and indexes for the rest of controllers.
