You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-05 17:15:09 +00:00
Adding InputMap action error suggestion for Input singleton
(cherry picked from commit a3b9842616)
This commit is contained in:
@@ -91,18 +91,12 @@ bool InputDefault::is_joy_button_pressed(int p_device, int p_button) const {
|
||||
}
|
||||
|
||||
bool InputDefault::is_action_pressed(const StringName &p_action, bool p_exact) const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
bool has_action = InputMap::get_singleton()->has_action(p_action);
|
||||
ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
|
||||
#endif
|
||||
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));
|
||||
return action_state.has(p_action) && action_state[p_action].pressed && (p_exact ? action_state[p_action].exact : true);
|
||||
}
|
||||
|
||||
bool InputDefault::is_action_just_pressed(const StringName &p_action, bool p_exact) const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
bool has_action = InputMap::get_singleton()->has_action(p_action);
|
||||
ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
|
||||
#endif
|
||||
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));
|
||||
const Map<StringName, Action>::Element *E = action_state.find(p_action);
|
||||
if (!E) {
|
||||
return false;
|
||||
@@ -120,10 +114,7 @@ bool InputDefault::is_action_just_pressed(const StringName &p_action, bool p_exa
|
||||
}
|
||||
|
||||
bool InputDefault::is_action_just_released(const StringName &p_action, bool p_exact) const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
bool has_action = InputMap::get_singleton()->has_action(p_action);
|
||||
ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
|
||||
#endif
|
||||
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), false, InputMap::get_singleton()->suggest_actions(p_action));
|
||||
const Map<StringName, Action>::Element *E = action_state.find(p_action);
|
||||
if (!E) {
|
||||
return false;
|
||||
@@ -141,10 +132,7 @@ bool InputDefault::is_action_just_released(const StringName &p_action, bool p_ex
|
||||
}
|
||||
|
||||
float InputDefault::get_action_strength(const StringName &p_action, bool p_exact) const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
bool has_action = InputMap::get_singleton()->has_action(p_action);
|
||||
ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
|
||||
#endif
|
||||
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), 0.0, InputMap::get_singleton()->suggest_actions(p_action));
|
||||
const Map<StringName, Action>::Element *E = action_state.find(p_action);
|
||||
if (!E) {
|
||||
return 0.0f;
|
||||
@@ -158,10 +146,7 @@ float InputDefault::get_action_strength(const StringName &p_action, bool p_exact
|
||||
}
|
||||
|
||||
float InputDefault::get_action_raw_strength(const StringName &p_action, bool p_exact) const {
|
||||
#ifdef DEBUG_ENABLED
|
||||
bool has_action = InputMap::get_singleton()->has_action(p_action);
|
||||
ERR_FAIL_COND_V_MSG(!has_action, false, "Request for nonexistent InputMap action '" + String(p_action) + "'.");
|
||||
#endif
|
||||
ERR_FAIL_COND_V_MSG(!InputMap::get_singleton()->has_action(p_action), 0.0, InputMap::get_singleton()->suggest_actions(p_action));
|
||||
const Map<StringName, Action>::Element *E = action_state.find(p_action);
|
||||
if (!E) {
|
||||
return 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user