39 lines
1.0 KiB
Markdown
39 lines
1.0 KiB
Markdown
# InputManager::GetButtonUp
|
|
|
|
查询一个具名逻辑按钮是否在本帧刚被释放。
|
|
|
|
```cpp
|
|
bool GetButtonUp(const Containers::String& buttonName) const;
|
|
```
|
|
|
|
## 行为说明
|
|
|
|
当前逻辑按钮只是“名字到 `KeyCode`”的映射。按当前实现,这个方法会:
|
|
|
|
1. 查找 `buttonName`
|
|
2. 如果找到,则对映射后的键调用 [IsKeyReleased](IsKeyReleased.md)
|
|
3. 如果没找到,则返回 `false`
|
|
|
|
这意味着它表达的是“释放边沿”,不是“当前没有按住”。如果你要判断逻辑按钮当前是否处于未按下状态,应先查映射,再结合 [GetButton](GetButton.md) 或物理键的 `IsKeyUp()` 语义处理。
|
|
|
|
## 参数
|
|
|
|
- `buttonName` - 逻辑按钮名称。
|
|
|
|
## 返回值
|
|
|
|
- `bool` - 该按钮是否在本帧刚被释放;未注册按钮返回 `false`。
|
|
|
|
## 示例
|
|
|
|
```cpp
|
|
bool released = XCEngine::Input::InputManager::Get().GetButtonUp("Jump");
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [返回类型总览](InputManager.md)
|
|
- [GetButton](GetButton.md)
|
|
- [GetButtonDown](GetButtonDown.md)
|
|
- [IsKeyReleased](IsKeyReleased.md)
|