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

> 取得輸入裝置上指定燈光群組選取範圍中的燈具數目。

取得輸入裝置上指定燈光群組選取範圍中的燈具數目。

## 語法

```cpp theme={null}
uint32_t GetSupportedLightingGroupSize(
    GameInputLightingGroups group
);
```

### 參數

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

要計算其燈具數目的燈光群組選取範圍。這可以是一或多個具名群組旗標、`GameInputLightingGroupAll` 或 `GameInputLightingGroupUnknown`。

### 傳回值

類型：uint32\_t

選取範圍中的燈具數目。如果裝置在選取範圍中沒有燈具，或 *group* 包含未定義的旗標，則傳回 0。

## 備註

*group* 的值解譯方式如下。

| *group* 的值 | 計算的燈具 |
| - | - |
| `GameInputLightingGroupAll` | 裝置上的每個燈具，包括不屬於具名群組的燈具。 |
| `GameInputLightingGroupUnknown` | 僅限不屬於任何具名群組的燈具。 |
| 一或多個具名群組旗標 | 選取範圍中每個具名群組之燈具數目的總和。 |

當您依序數定址個別燈具時，選取範圍的燈具數目是 [IGameInputDevice::SetLightingColor](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setlightingcolor.md) 之 *groupOrderIndex* 參數的上限 (不含)。例外的是 `GameInputLightingGroupKeyboardKey`，它改為依鍵盤掃描碼定址個別燈具。

下列範例會以不同深淺的綠色點亮正面按鈕群組中的每個燈具。

```cpp theme={null}
void SetFaceButtonGradient(IGameInputDevice* device) noexcept
{
    const uint32_t lampCount = device->GetSupportedLightingGroupSize(GameInputLightingGroupFaceButtons);
    for (uint32_t i = 0; i < lampCount; ++i)
    {
        const uint8_t green = static_cast<uint8_t>(255 * (i + 1) / lampCount);
        device->SetLightingColor({ 0, green, 0 }, GameInputLightingGroupFaceButtons, i);
    }

    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::GetSupportedLightingGroups](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedlightinggroups.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)

## 版本歷程記錄

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


## Related topics

- [IGameInputDevice::GetSupportedLightingGroups](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedlightinggroups.md)
- [IGameInputDevice::SetLightingColor](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setlightingcolor.md)
- [IGameInputDevice::GetSupportedInput](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedinput.md)
- [IGameInputDevice::GetSupportedRumbleMotors](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedrumblemotors.md)
- [IGameInputDevice::GetSupportedSystemButtons](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getsupportedsystembuttons.md)
