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

36 lines
701 B
Markdown

# InputManager::GetButtonDown
查询一个具名逻辑按钮是否在本帧刚被按下。
```cpp
bool GetButtonDown(const Containers::String& buttonName) const;
```
## 行为说明
当前实现把逻辑按钮当作 `KeyCode` 别名处理,因此这个方法等价于对映射后的键调用 `IsKeyPressed()`
如果按钮名未注册,返回 `false`
## 参数
- `buttonName` - 逻辑按钮名称。
## 返回值
- `bool` - 该按钮是否在本帧刚被按下。
## 示例
```cpp
if (XCEngine::Input::InputManager::Get().GetButtonDown("Fire1")) {
// ...
}
```
## 相关文档
- [返回类型总览](InputManager.md)
- [GetButton](GetButton.md)
- [GetButtonUp](GetButtonUp.md)