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

38 lines
793 B
Markdown
Raw Normal View History

2026-04-08 16:07:03 +08:00
# InputManager::IsAnyKeyDown
查询是否存在任意键盘键或鼠标按键当前处于按住状态。
```cpp
bool IsAnyKeyDown() const;
```
## 行为说明
当前实现会:
- 如果未初始化,返回 `false`
- 先扫描 `m_keyDown`
- 再扫描 `m_mouseButtonDown`
- 任一数组里存在 `true` 就返回 `true`
这意味着当前 “any key” 的统计范围并不只限于键盘,鼠标按键也会让它成立。
## 返回值
- `bool` - 当前是否存在任意键盘键或鼠标按键处于按住状态。
## 示例
```cpp
if (XCEngine::Input::InputManager::Get().IsAnyKeyDown()) {
// ...
}
```
## 相关文档
- [返回类型总览](InputManager.md)
- [IsAnyKeyPressed](IsAnyKeyPressed.md)
- [IsKeyDown](IsKeyDown.md)
- [IsMouseButtonDown](IsMouseButtonDown.md)