docs: sync api and planning docs
This commit is contained in:
41
docs/api/XCEngine/Input/InputManager/IsKeyReleased.md
Normal file
41
docs/api/XCEngine/Input/InputManager/IsKeyReleased.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# InputManager::IsKeyReleased
|
||||
|
||||
查询一个键是否在本帧刚被释放。
|
||||
|
||||
```cpp
|
||||
bool IsKeyReleased(KeyCode key) const;
|
||||
```
|
||||
|
||||
## 行为说明
|
||||
|
||||
当前实现会:
|
||||
|
||||
- 如果未初始化,返回 `false`
|
||||
- 把 `KeyCode` 强转成数组下标
|
||||
- 如果下标越界,返回 `false`
|
||||
- 否则返回 `m_keyUpThisFrame[index]`
|
||||
|
||||
这个标志位由 [ProcessKeyUp](ProcessKeyUp.md) 写入,并会在 [Update](Update.md) 时被清空,因此它表达的是“释放边沿”,不是“当前没有按住”。
|
||||
|
||||
## 参数
|
||||
|
||||
- `key` - 要查询的键。
|
||||
|
||||
## 返回值
|
||||
|
||||
- `bool` - 当前帧是否刚被释放。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
if (XCEngine::Input::InputManager::Get().IsKeyReleased(XCEngine::Input::KeyCode::Space)) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [返回类型总览](InputManager.md)
|
||||
- [ProcessKeyUp](ProcessKeyUp.md)
|
||||
- [Update](Update.md)
|
||||
- [IsKeyUp](IsKeyUp.md)
|
||||
Reference in New Issue
Block a user