> ## 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::GetSupportedLightingGroups

> 获取输入设备在其中具有可控灯的灯光组。

获取输入设备在其中具有可控灯的灯光组。

## 语法

```cpp theme={null}
GameInputLightingGroups GetSupportedLightingGroups();
```

### 参数

此方法没有参数。

### 返回值

类型：[GameInputLightingGroups](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/enums/gameinputlightinggroups)

`GameInputLightingGroups` 标志的组合，对应于设备上至少包含一个灯的每个命名灯光组。如果设备在任何命名组中都没有灯，则返回 `GameInputLightingGroupUnknown` (0)。

## 备注

返回值中的每个标志都标识一个命名的灯组，例如 `GameInputLightingGroupFaceButtons` 或 `GameInputLightingGroupCenterLight`，你可以使用 [IGameInputDevice::SetLightingColor](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setlightingcolor.md) 对其进行寻址。该方法从不将 `GameInputLightingGroupUnknown` 报告为一个组，因为其值为 0。

设备可能具有不属于任何命名组的灯。因此，返回值为 0 并不总是意味着设备没有灯。若要确定设备是否支持灯光，请检查 [IGameInputDevice::GetSupportedInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md) 是否包含 `GameInputKindLighting`，或者使用 `GameInputLightingGroupAll` 调用 [IGameInputDevice::GetSupportedLightingGroupSize](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedlightinggroupsize.md)。若要统计不在命名组中的灯，请使用 `GameInputLightingGroupUnknown` 调用 `GetSupportedLightingGroupSize`。

以下示例在具有相应组的设备上将正面按钮设置为红色、将中央灯设置为蓝色，然后通过一次更新应用这些颜色。

```cpp theme={null}
void SetControllerLighting(IGameInputDevice* device) noexcept
{
    const GameInputLightingGroups groups = device->GetSupportedLightingGroups();

    if ((groups & GameInputLightingGroupFaceButtons) != 0)
    {
        device->SetLightingColor({ 255, 0, 0 }, GameInputLightingGroupFaceButtons);
    }

    if ((groups & GameInputLightingGroupCenterLight) != 0)
    {
        device->SetLightingColor({ 0, 0, 255 }, GameInputLightingGroupCenterLight);
    }

    device->ApplyLightingColors();
}
```

支持的灯光组集在设备对象的生存期内不会更改。

> [!NOTE]
>
> 灯光支持取决于设备和平台。目前，GameInput 支持 Windows 动态光效 (LampArray) 设备以及 DualSense 控制器灯条的灯光。

## 要求

**头文件：** GameInput.h

**库：** gameinput.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## 另请参阅

[GameInput 概述](https://docs.xbox.com/zh-CN/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputDevice](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)\
[GameInputLightingGroups](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/enums/gameinputlightinggroups)\
[IGameInputDevice::GetSupportedLightingGroupSize](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedlightinggroupsize.md)\
[IGameInputDevice::SetLightingColor](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setlightingcolor.md)\
[IGameInputDevice::ApplyLightingColors](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_applylightingcolors.md)\
[IGameInputDevice::ApplyLightingSystemDefault](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_applylightingsystemdefault.md)

## 版本历史

| 版本 | 变更 |
| - | - |
| **v4** | 引入。 |


## Related topics

- [IGameInputDevice::GetSupportedLightingGroupSize](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedlightinggroupsize.md)
- [IGameInputDevice::SetLightingColor](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setlightingcolor.md)
- [IGameInputDevice::ApplyLightingColors](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_applylightingcolors.md)
- [IGameInputDevice::GetSupportedInput](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md)
- [IGameInputDevice::GetDeviceFamily](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicefamily.md)
