docs: sync api and planning docs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# InputManager::GetButtonUp
|
||||
|
||||
查询一个具名逻辑按钮当前是否处于抬起状态。
|
||||
查询一个具名逻辑按钮是否在本帧刚被释放。
|
||||
|
||||
```cpp
|
||||
bool GetButtonUp(const Containers::String& buttonName) const;
|
||||
@@ -8,9 +8,13 @@ bool GetButtonUp(const Containers::String& buttonName) const;
|
||||
|
||||
## 行为说明
|
||||
|
||||
如果按钮名已注册,当前实现会对映射后的键调用 `IsKeyUp()`。如果按钮名未注册,当前实现直接返回 `true`。
|
||||
当前逻辑按钮只是“名字到 `KeyCode`”的映射。按当前实现,这个方法会:
|
||||
|
||||
这个“未注册也算 Up”是当前行为,不一定符合所有上层代码的直觉。
|
||||
1. 查找 `buttonName`
|
||||
2. 如果找到,则对映射后的键调用 [IsKeyReleased](IsKeyReleased.md)
|
||||
3. 如果没找到,则返回 `false`
|
||||
|
||||
这意味着它表达的是“释放边沿”,不是“当前没有按住”。如果你要判断逻辑按钮当前是否处于未按下状态,应先查映射,再结合 [GetButton](GetButton.md) 或物理键的 `IsKeyUp()` 语义处理。
|
||||
|
||||
## 参数
|
||||
|
||||
@@ -18,7 +22,7 @@ bool GetButtonUp(const Containers::String& buttonName) const;
|
||||
|
||||
## 返回值
|
||||
|
||||
- `bool` - 当前是否处于抬起状态;未注册按钮也会返回 `true`。
|
||||
- `bool` - 该按钮是否在本帧刚被释放;未注册按钮返回 `false`。
|
||||
|
||||
## 示例
|
||||
|
||||
@@ -30,3 +34,5 @@ bool released = XCEngine::Input::InputManager::Get().GetButtonUp("Jump");
|
||||
|
||||
- [返回类型总览](InputManager.md)
|
||||
- [GetButton](GetButton.md)
|
||||
- [GetButtonDown](GetButtonDown.md)
|
||||
- [IsKeyReleased](IsKeyReleased.md)
|
||||
|
||||
Reference in New Issue
Block a user