# Understanding the Gamepad-Mapping

**URL:** <https://discourse.glfw.org/t/understanding-the-gamepad-mapping/2199>\
**Category:** dev\
**Created:** [November 24, 2022, 12:22pm UTC](https://discourse.glfw.org/t/understanding-the-gamepad-mapping/2199 "2022-11-24T12:22:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![uwi2k2](https://avatars.discourse-cdn.com/v4/letter/u/cab0a1/32.png) [@uwi2k2](https://discourse.glfw.org/u/uwi2k2)\
**Post date:** [November 24, 2022, 12:22pm UTC](https://discourse.glfw.org/t/understanding-the-gamepad-mapping/2199/1 "2022-11-24T12:22:56Z")

</div>

Hello there,

in my game i implemented gamepad controlling.  
But different gamepads behave differently.

This is were the MAPPING comes in i guess. But i just don´t understand how to use it.

in my code i load a mapping txt file with this text in the first line: “# Game Controller DB for SDL in 2.0.16 format”.  
It has about 1800 controllers listed.

I guess this file is already loaded by default but i was not sure.

Anyway … all my controllers behave differently.  
Button indexes or AnaogStick indexes are all very different form controller to controller.

So my question is: HOW do i make use of this loaded mapping file?  
I checked almost all functions about this and just don´t see any that seem to have something to do with the mapping.

I would be very thankful if someone can explain the basic usage of the mapping to me.

thanks in advance!  
cu  
kai

---

<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:** [November 24, 2022, 1:02pm UTC](https://discourse.glfw.org/t/understanding-the-gamepad-mapping/2199/2 "2022-11-24T13:02:30Z")

</div>

Hi @uwi2k2 and welcome to the GLFW forum!

First of make sure to read the [gamepad input documentation](https://www.glfw.org/docs/latest/input_guide.html#gamepad).

The gamepad mappings are used internally to map the gamepad inputs to the `GLFWgamepadstate` when you call the function `glfwGetGamepadState`.

---

<div class="post-metadata">

**Author:** ![uwi2k2](https://avatars.discourse-cdn.com/v4/letter/u/cab0a1/32.png) [@uwi2k2](https://discourse.glfw.org/u/uwi2k2)\
**Post date:** [November 25, 2022, 10:20am UTC](https://discourse.glfw.org/t/understanding-the-gamepad-mapping/2199/3 "2022-11-25T10:20:38Z")

</div>

Perfect!

Thank you very mutch!!!  
You really help me.

kai
