summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-11-08 09:55:11 +0100
committerGitHub <noreply@github.com>2019-11-08 09:55:11 +0100
commit31f327a4a9c2637a8d2ada01b293ed138c3e6f99 (patch)
tree9de30df79b199068abd129482c9892646b38de2a /core
parenta3ac7a94f05082327e91e14f4772b9a94e969ee4 (diff)
parenta7b202ef188c789da8940f4fea285485063801b6 (diff)
downloadredot-engine-31f327a4a9c2637a8d2ada01b293ed138c3e6f99.tar.gz
Merge pull request #33052 from KoBeWi/naughty_sliders
Fix analog input in sliders
Diffstat (limited to 'core')
-rw-r--r--core/os/input_event.cpp6
-rw-r--r--core/os/input_event.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 381ba9d010..8f1eb93fe6 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -49,11 +49,11 @@ bool InputEvent::is_action(const StringName &p_action) const {
return InputMap::get_singleton()->event_is_action(Ref<InputEvent>((InputEvent *)this), p_action);
}
-bool InputEvent::is_action_pressed(const StringName &p_action) const {
+bool InputEvent::is_action_pressed(const StringName &p_action, bool p_allow_echo) const {
bool pressed;
bool valid = InputMap::get_singleton()->event_get_action_status(Ref<InputEvent>((InputEvent *)this), p_action, &pressed);
- return valid && pressed && !is_echo();
+ return valid && pressed && (p_allow_echo || !is_echo());
}
bool InputEvent::is_action_released(const StringName &p_action) const {
@@ -112,7 +112,7 @@ void InputEvent::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_device"), &InputEvent::get_device);
ClassDB::bind_method(D_METHOD("is_action", "action"), &InputEvent::is_action);
- ClassDB::bind_method(D_METHOD("is_action_pressed", "action"), &InputEvent::is_action_pressed);
+ ClassDB::bind_method(D_METHOD("is_action_pressed", "action"), &InputEvent::is_action_pressed, DEFVAL(false));
ClassDB::bind_method(D_METHOD("is_action_released", "action"), &InputEvent::is_action_released);
ClassDB::bind_method(D_METHOD("get_action_strength", "action"), &InputEvent::get_action_strength);
diff --git a/core/os/input_event.h b/core/os/input_event.h
index 14649502ee..a4db618bfe 100644
--- a/core/os/input_event.h
+++ b/core/os/input_event.h
@@ -184,7 +184,7 @@ public:
int get_device() const;
bool is_action(const StringName &p_action) const;
- bool is_action_pressed(const StringName &p_action) const;
+ bool is_action_pressed(const StringName &p_action, bool p_allow_echo = false) const;
bool is_action_released(const StringName &p_action) const;
float get_action_strength(const StringName &p_action) const;