> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IGameInputDevice::GetControllerAxisLabels

> Retrieves the labels of the generic controller axes on the device.

Retrieves the labels of the generic controller axes on the device.

## Syntax

```cpp theme={null}
uint32_t GetControllerAxisLabels(
    uint32_t labelArrayCount,
    GameInputLabel* labelArray
);
```

### Parameters

*labelArrayCount*   \_In\_\
Type: uint32\_t

Number of elements in *labelArray*. To retrieve all controller axis labels, pass the value returned by [GetControllerAxisCount](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxiscount.md).

*labelArray*   \_Out\_writes\_to\_opt\_(labelArrayCount, return)\
Type: [GameInputLabel](https://docs.xbox.com/reference/input/gameinput/enums/gameinputlabel.md)\*

Pointer to an array that receives one label per controller axis. Can be `nullptr`, in which case nothing is written and the method returns 0.

### Return value

Type: uint32\_t

The number of elements written to *labelArray*. This is the smaller of *labelArrayCount* and the number of controller axis labels on the device, or 0 if *labelArray* is `nullptr` or the device has no controller axis labels.

## Remarks

Each element is a [GameInputLabel](https://docs.xbox.com/reference/input/gameinput/enums/gameinputlabel.md) value that identifies the marking printed on the corresponding axis, if the device reports one.

Call [GetControllerAxisCount](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxiscount.md) to get the number of controller axis labels, allocate an array of that size, and then call `GetControllerAxisLabels` to fill it. If *labelArrayCount* is smaller than the number of controller axis labels, only the first *labelArrayCount* elements are written. The controller axis labels of a device don't change while the device is connected, so you can query them once and cache the result.

Element *i* of the label array describes the axis at index *i* of the array returned by [IGameInputReading::GetControllerAxisState](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxisstate.md) for readings from this device.

The following example shows how to retrieve the controller axis labels of a device.

```cpp theme={null}
uint32_t axisCount = device->GetControllerAxisCount();
std::vector<GameInputLabel> axisLabels(axisCount);
axisLabels.resize(device->GetControllerAxisLabels(axisCount, axisLabels.data()));

std::vector<float> axisStates(reading->GetControllerAxisCount());
reading->GetControllerAxisState(static_cast<uint32_t>(axisStates.size()), axisStates.data());

for (size_t i = 0; i < axisLabels.size() && i < axisStates.size(); ++i)
{
    // axisLabels[i] is the label of the axis whose value is axisStates[i].
}
```

In GameInput v3 and earlier, this information was available from the `controllerAxisLabels` member of the [GameInputControllerInfo](https://docs.xbox.com/reference/input/gameinput/deprecated/structs/gameinputcontrollerinfo.md) structure, which was referenced by the `controllerInfo` member of the [GameInputDeviceInfo](https://docs.xbox.com/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) structure returned by [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md).

## Requirements

**Header:** GameInput.h

**Library:** gameinput.lib

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[Overview of GameInput](https://docs.xbox.com/build/core-features/common/input/overviews/input-overview.md)\
[GetControllerAxisCount](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxiscount.md)\
[GameInputLabel](https://docs.xbox.com/reference/input/gameinput/enums/gameinputlabel.md)\
[IGameInputReading::GetControllerAxisState](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getcontrolleraxisstate.md)\
[IGameInputDevice](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)

## Version History

| Version | Changes |
| - | - |
| **v4** | Introduced. |


## Related topics

- [GameInputLabel](https://docs.xbox.com/reference/input/gameinput/enums/gameinputlabel.md)
- [IGameInputDevice::GetControllerAxisCount](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrolleraxiscount.md)
- [IGameInputDevice::GetControllerButtonLabels](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontrollerbuttonlabels.md)
- [IGameInputDevice::GetGamepadInfo](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getgamepadinfo.md)
- [IGameInputDevice::GetFlightStickInfo](https://docs.xbox.com/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getflightstickinfo.md)
