mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add support for event accumlation (off by default, on for editor), fixes #26536
This commit is contained in:
parent
a9fe834a8e
commit
a1e73dcc94
10 changed files with 106 additions and 17 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue