> ## 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-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setlightingcolor.md) 加以定址。此方法永遠不會將 `GameInputLightingGroupUnknown` 回報為群組，因為其值為 0。

裝置可能具有不屬於任何具名群組的燈具。因此，傳回值為 0 並不一定表示裝置沒有燈具。若要判斷裝置是否支援燈光，請檢查 [IGameInputDevice::GetSupportedInput](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md) 是否包含 `GameInputKindLighting`，或以 `GameInputLightingGroupAll` 呼叫 [IGameInputDevice::GetSupportedLightingGroupSize](https://docs.xbox.com/zh-TW/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-TW/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputDevice](https://docs.xbox.com/zh-TW/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-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedlightinggroupsize.md)\
[IGameInputDevice::SetLightingColor](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setlightingcolor.md)\
[IGameInputDevice::ApplyLightingColors](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_applylightingcolors.md)\
[IGameInputDevice::ApplyLightingSystemDefault](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_applylightingsystemdefault.md)

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v4** | 已推出。 |


## Related topics

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