Share via


GameInputGamepadInfo

Describes the properties of a gamepad.

Syntax

struct GameInputGamepadInfo
{
    GameInputGamepadButtons supportedLayout;
    GameInputLabel          menuButtonLabel;
    GameInputLabel          viewButtonLabel;
    GameInputLabel          aButtonLabel;
    GameInputLabel          bButtonLabel;
    GameInputLabel          cButtonLabel;
    GameInputLabel          xButtonLabel;
    GameInputLabel          yButtonLabel;
    GameInputLabel          zButtonLabel;
    GameInputLabel          dpadUpLabel;
    GameInputLabel          dpadDownLabel;
    GameInputLabel          dpadLeftLabel;
    GameInputLabel          dpadRightLabel;
    GameInputLabel          leftShoulderButtonLabel;
    GameInputLabel          rightShoulderButtonLabel;
    GameInputLabel          leftThumbstickButtonLabel;
    GameInputLabel          rightThumbstickButtonLabel;
    uint32_t                extraButtonCount;
    uint32_t                extraAxisCount;
};

Members

supportedLayout
Type: GameInputGamepadButtons

Describes the layout of the gamepad. Since axes have button translations, then these can be used to determine which axes are present on the gamepad.

menuButtonLabel
Type: GameInputLabel

Physical label for Menu button.

viewButtonLabel
Type: GameInputLabel

Physical label for View button.

aButtonLabel
Type: GameInputLabel

Physical label for A button.

bButtonLabel
Type: GameInputLabel

Physical label for B button.

cButtonLabel
Type: GameInputLabel

Physical label for C button.

xButtonLabel
Type: GameInputLabel

Physical label for X button.

yButtonLabel
Type: GameInputLabel

Physical label for Y button.

zButtonLabel
Type: GameInputLabel

Physical label for Z button.

dpadUpLabel
Type: GameInputLabel

Physical label for D-pad up.

dpadDownLabel
Type: GameInputLabel

Physical label for D-pad down.

dpadLeftLabel
Type: GameInputLabel

Physical label for D-pad left.

dpadRightLabel
Type: GameInputLabel

Physical label for D-Pad right.

leftShoulderButtonLabel
Type: GameInputLabel

Physical label for left shoulder button.

rightShoulderButtonLabel
Type: GameInputLabel

Physical label for right shoulder button.

leftThumbstickButtonLabel
Type: GameInputLabel

Physical label for left thumbstick.

rightThumbstickButtonLabel
Type: GameInputLabel

Physical label for right thumbstick.

extraButtonCount
Type: uint32_t

The number of device buttons that are not mapped to gamepad buttons.

extraAxisCount
Type: uint32_t

The number of device axes that are not mapped to gamepad axes.

Remarks

This structure is used in the GameInputDeviceInfo structure.

GameInputDeviceInfo is used by the IGameInputDevice::GetDeviceInfo method.

For more information, see GameInput devices.

Gamepad Layout

GameInput supports a range of form factors for gamepads instead of limiting support to a single standard layout. This is exposed through the supportedLayout member of this structure as a bitfield of type GameInputGamepadButtons. Axes are also present in this enumeration through the axis-to-button translations such as GameInputGamepadLeftTriggerButton. For more information on these translations, see GameInputGamepadButtons.

There is no minimum required layout for a gamepad and it may have any combination of the supported axes and buttons. Any buttons or axes not supported is expected to be left and accessed as extra axes or buttons.

We have defined some common groupings of gamepad elements and common layouts as constants. These can be used to quickly identify a common layout, filter for a specific inputs or create custom layouts. For more information, see GameInputGamepadButtons.

Since the expected range of supported layouts and form factors is limitless, there are small set of considerations and behaviors that we expect for mappings and gamepad users to follow:

  • For elements of which there are two, such as thumbsticks, shoulder or triggers, if there is one present in the center, then the default should be for it be the left element. If it is positioned to the left or right of the device, then it should be mapped accordingly.

  • In order to prevent ambiguity due to different glyphs, face buttons are expected to be mapped and read according to their physical position and regardless of its glyph as following:

Gamepad face button layout guidelines

The following code example demonstrates how to determine whether a gamepad supports a layout or a specific input or module.

bool IsStandardLayout(const GameInputGamepadInfo& gamepadInfo) noexcept
{
    // Supports the standard layout and no more
    return (gamepadInfo.supportedLayout & GameInputGamepadLayoutStandard) == GameInputGamepadLayoutStandard;
}

bool IsDpadSupported(const GameInputGamepadInfo& gamepadInfo) noexcept
{
    // Supports the D-pad module and more
    return gamepadInfo.supportedLayout & GameInputGamepadModuleDpad;
}

bool IsXButtonSupported(const GameInputGamepadInfo& gamepadInfo) noexcept
{
    return gamepadInfo.supportedLayout & GameInputGamepadX;
}

The following code example demonstrates how to create a custom layout and determine if the gamepad supports it.

bool IsCustomLayoutSupported(const GameInputGamepadInfo& gamepadInfo) noexcept
{
    static const GameInputGamepadButtons customLayout =
        GameInputGamepadA |
        GameInputGamepadB |
        GameInputGamepadC |
        GameInputGamepadX |
        GameInputGamepadY |
        GameInputGamepadZ |
        GameInputGamepadModuleShoulders |
        GameInputGamepadModuleDpad;

    return (gamepadInfo.supportedLayout & customLayout) == GameInputGamepadLayoutCustom;
}

Requirements

Header: GameInput.h

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

Overview of GameInput
GameInput