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

701 B

InputManager::GetButtonDown

查询一个具名逻辑按钮是否在本帧刚被按下。

bool GetButtonDown(const Containers::String& buttonName) const;

行为说明

当前实现把逻辑按钮当作 KeyCode 别名处理,因此这个方法等价于对映射后的键调用 IsKeyPressed()

如果按钮名未注册,返回 false

参数

  • buttonName - 逻辑按钮名称。

返回值

  • bool - 该按钮是否在本帧刚被按下。

示例

if (XCEngine::Input::InputManager::Get().GetButtonDown("Fire1")) {
    // ...
}

相关文档