gamepad_set_button_threshold

此函数可用于设置给定设备模拟按钮的当前阈值设置。所有模拟按钮的默认阈值为0.5,范围为0至1。

阈值定义了在需要将其充当数字按钮的游戏中,按钮被视为 “按下”。

此函数将影响模拟按钮的检查,按下释放状态,但不会影响函数gamepad_button_value()返回的值,该值将始终返回按钮的原始值。

 

语法:

gamepad_set_button_threshold(device, threshold);

参数类型描述
deviceReal要检查哪个游戏手柄设备 “插槽”。
thresholdReal新的阈值(从 0 到 1,默认为 0.5)。

 

返回:

N/A

 

例子:

if (gamepad_get_button_threshold(0) != 0.5)
{
    gamepad_set_button_threshold(0, 0.5);
}

上面的代码检查连接到设备 “slot” 0 的游戏手柄的模拟按钮阈值,如果它不是默认值 0.5,则将其设置为该值。