Files
XCEngine/docs/api/XCEngine/Input/InputManager/GetTouch.md

33 lines
677 B
Markdown

# InputManager::GetTouch
读取指定索引的触点状态。
```cpp
TouchState GetTouch(int index) const;
```
## 行为说明
如果 `index` 合法,当前实现返回 `m_touches[index]` 的拷贝;否则返回默认构造的 `TouchState{}`
由于当前公开代码路径并不会填充 `m_touches`,这个接口大多数情况下只会返回默认值。
## 参数
- `index` - 触点索引。
## 返回值
- `TouchState` - 指定触点状态;非法索引时为默认构造值。
## 示例
```cpp
auto touch = XCEngine::Input::InputManager::Get().GetTouch(0);
```
## 相关文档
- [返回类型总览](InputManager.md)
- [GetTouchCount](GetTouchCount.md)