|
@@ -696,31 +696,39 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
|
|
|
|
|
|
ERR_FAIL_COND(p_event.is_null());
|
|
ERR_FAIL_COND(p_event.is_null());
|
|
|
|
|
|
- if (!use_accumulated_input) {
|
|
|
|
|
|
+ if (use_accumulated_input) {
|
|
|
|
+ if (buffered_events.empty() || !buffered_events.back()->get()->accumulate(p_event)) {
|
|
|
|
+ buffered_events.push_back(p_event);
|
|
|
|
+ }
|
|
|
|
+ } else if (use_input_buffering) {
|
|
|
|
+ buffered_events.push_back(p_event);
|
|
|
|
+ } else {
|
|
_parse_input_event_impl(p_event, false);
|
|
_parse_input_event_impl(p_event, false);
|
|
- return;
|
|
|
|
}
|
|
}
|
|
- if (!accumulated_events.empty() && accumulated_events.back()->get()->accumulate(p_event)) {
|
|
|
|
- return; //event was accumulated, exit
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- accumulated_events.push_back(p_event);
|
|
|
|
}
|
|
}
|
|
-void InputDefault::flush_accumulated_events() {
|
|
|
|
|
|
+void InputDefault::flush_buffered_events() {
|
|
_THREAD_SAFE_METHOD_
|
|
_THREAD_SAFE_METHOD_
|
|
|
|
|
|
- while (accumulated_events.front()) {
|
|
|
|
- _parse_input_event_impl(accumulated_events.front()->get(), false);
|
|
|
|
- accumulated_events.pop_front();
|
|
|
|
|
|
+ while (buffered_events.front()) {
|
|
|
|
+ _parse_input_event_impl(buffered_events.front()->get(), false);
|
|
|
|
+ buffered_events.pop_front();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool InputDefault::is_using_input_buffering() {
|
|
|
|
+ return use_input_buffering;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void InputDefault::set_use_input_buffering(bool p_enable) {
|
|
|
|
+ use_input_buffering = p_enable;
|
|
|
|
+}
|
|
|
|
+
|
|
void InputDefault::set_use_accumulated_input(bool p_enable) {
|
|
void InputDefault::set_use_accumulated_input(bool p_enable) {
|
|
use_accumulated_input = p_enable;
|
|
use_accumulated_input = p_enable;
|
|
}
|
|
}
|
|
|
|
|
|
void InputDefault::release_pressed_events() {
|
|
void InputDefault::release_pressed_events() {
|
|
- flush_accumulated_events(); // this is needed to release actions strengths
|
|
|
|
|
|
+ flush_buffered_events(); // this is needed to release actions strengths
|
|
|
|
|
|
keys_pressed.clear();
|
|
keys_pressed.clear();
|
|
joy_buttons_pressed.clear();
|
|
joy_buttons_pressed.clear();
|
|
@@ -734,6 +742,7 @@ void InputDefault::release_pressed_events() {
|
|
}
|
|
}
|
|
|
|
|
|
InputDefault::InputDefault() {
|
|
InputDefault::InputDefault() {
|
|
|
|
+ use_input_buffering = false;
|
|
use_accumulated_input = false;
|
|
use_accumulated_input = false;
|
|
mouse_button_mask = 0;
|
|
mouse_button_mask = 0;
|
|
emulate_touch_from_mouse = false;
|
|
emulate_touch_from_mouse = false;
|