diff options
Diffstat (limited to 'main/input_default.cpp')
-rw-r--r-- | main/input_default.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp index 18b4649f4d..fd76b91a0b 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -657,8 +657,35 @@ void InputDefault::set_mouse_in_window(bool p_in_window) { */ } +void InputDefault::accumulate_input_event(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + + if (!use_accumulated_input) { + parse_input_event(p_event); + 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() { + + while (accumulated_events.front()) { + parse_input_event(accumulated_events.front()->get()); + accumulated_events.pop_front(); + } +} + +void InputDefault::set_use_accumulated_input(bool p_enable) { + + use_accumulated_input = p_enable; +} + InputDefault::InputDefault() { + use_accumulated_input = false; mouse_button_mask = 0; emulate_touch_from_mouse = false; emulate_mouse_from_touch = false; |