summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/input_default.cpp13
-rw-r--r--main/input_default.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 6c3252ad1a..a939d77a1e 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -677,6 +677,19 @@ void InputDefault::set_use_accumulated_input(bool p_enable) {
use_accumulated_input = p_enable;
}
+void InputDefault::release_pressed_events() {
+
+ flush_accumulated_events(); // this is needed to release actions strengths
+
+ keys_pressed.clear();
+ joy_buttons_pressed.clear();
+ _joy_axis.clear();
+
+ for (Map<StringName, InputDefault::Action>::Element *E = action_state.front(); E; E = E->next()) {
+ action_release(E->key());
+ }
+}
+
InputDefault::InputDefault() {
use_accumulated_input = true;
diff --git a/main/input_default.h b/main/input_default.h
index f9b4cbbd57..80ee17656c 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -272,6 +272,7 @@ public:
virtual void flush_accumulated_events();
virtual void set_use_accumulated_input(bool p_enable);
+ virtual void release_pressed_events();
InputDefault();
};