> ## 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.

# IGameInputReading::GetTouchContactCount

> 检索输入读数中某个触摸表面上的接触点数量。

检索输入读数中某个触摸表面上的接触点数量。

## 语法

```cpp theme={null}
uint32_t GetTouchContactCount(
    uint32_t surfaceIndex
);
```

### 参数

*surfaceIndex*   \_In\_\
类型：uint32\_t

触摸表面的索引。必须小于 [IGameInputDevice::GetTouchSurfaceCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfacecount.md) 返回的值。

### 返回值

类型：uint32\_t

此读数中该触摸表面上的接触点数量。如果读数不包含触摸数据，或者 *surfaceIndex* 不是有效的表面索引，则返回 0。

## 备注

使用此方法确定传递给 [IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md) 的数组的大小。使用 null 接触点数组调用 `GetTouchSurfaceState` 也会返回接触点数量。若要分配一个对任何读数都足够大的数组，请使用 [GameInputTouchSurfaceInfo](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/structs/gameinputtouchsurfaceinfo) 的 `maxContactCount` 成员。

包含触摸数据的读数会在 [IGameInputReading::GetInputKind](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getinputkind.md) 中包含 `GameInputKindTouch`。

> [!NOTE]
>
> 触摸支持取决于设备和平台。

## 要求

**头文件：** 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)\
[IGameInputReading](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/igameinputreading.md)\
[IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md)\
[IGameInputDevice::GetTouchSurfaceInfo](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfaceinfo.md)\
[GameInputTouchContact](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/structs/gameinputtouchcontact)

## 版本历史

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


## Related topics

- [IGameInputReading::GetTouchSurfaceState](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_gettouchsurfacestate.md)
- [IGameInputReading::GetTouchCount（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputreading/methods/igameinputreading_gettouchcount.md)
- [IGameInputReading::GetTouchState（已弃用）](https://docs.xbox.com/zh-CN/reference/input/gameinput/deprecated/interfaces/igameinputreading/methods/igameinputreading_gettouchstate.md)
- [IGameInputDevice::GetTouchSurfaceCount](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_gettouchsurfacecount.md)
- [IGameInputReading::GetSystemButtonState](https://docs.xbox.com/zh-CN/reference/input/gameinput/interfaces/igameinputreading/methods/igameinputreading_getsystembuttonstate.md)
