docs: rebuild Input API content
This commit is contained in:
@@ -1,30 +1,34 @@
|
||||
# InputManager::OnKeyEvent
|
||||
|
||||
公开方法,详见头文件声明。
|
||||
获取键盘事件通道。
|
||||
|
||||
```cpp
|
||||
Core::Event<const KeyEvent&>& OnKeyEvent();
|
||||
```
|
||||
|
||||
该方法声明于 `XCEngine/Input/InputManager.h`,当前页面用于固定 `InputManager` 类目录下的方法级 canonical 路径。
|
||||
## 行为说明
|
||||
|
||||
**参数:** 无。
|
||||
返回内部 `Core::Event<const KeyEvent&>` 引用。当前事件会在 [ProcessKeyDown](ProcessKeyDown.md) 和 [ProcessKeyUp](ProcessKeyUp.md) 中同步触发。
|
||||
|
||||
**返回:** `Core::Event<const KeyEvent&>&` - 返回值语义详见头文件声明。
|
||||
需要注意:
|
||||
|
||||
**示例:**
|
||||
- 回调执行线程就是调用 `Process*` 的线程。
|
||||
- 当前 `Shutdown()` 不会清空这个事件对象中的监听器。
|
||||
|
||||
## 返回值
|
||||
|
||||
- `Core::Event<const KeyEvent&>&` - 键盘事件通道。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Input/InputManager.h>
|
||||
|
||||
void Example() {
|
||||
XCEngine::Input::InputManager object;
|
||||
// 根据上下文补齐参数后调用 InputManager::OnKeyEvent(...)。
|
||||
(void)object;
|
||||
}
|
||||
auto id = XCEngine::Input::InputManager::Get().OnKeyEvent().Subscribe(
|
||||
[](const XCEngine::Input::KeyEvent& e) {}
|
||||
);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类总览](InputManager.md)
|
||||
- [返回模块目录](../Input.md)
|
||||
- [返回类型总览](InputManager.md)
|
||||
- [ProcessKeyDown](ProcessKeyDown.md)
|
||||
- [ProcessKeyUp](ProcessKeyUp.md)
|
||||
|
||||
Reference in New Issue
Block a user