From beb99fe54bfa65ad3aaa6a6d6ec44bdabedb96e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Thu, 14 Oct 2021 18:58:15 +0200 Subject: [PATCH] Expose Input::flush_buffered_events() (cherry picked from commit 6dc3fae201574cca599b322d24bb091bd1dbdcbd) --- core/os/input.cpp | 1 + doc/classes/Input.xml | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/core/os/input.cpp b/core/os/input.cpp index 7d81a866955..66ea5f6d314 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -102,6 +102,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "shape", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2())); ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event); ClassDB::bind_method(D_METHOD("set_use_accumulated_input", "enable"), &Input::set_use_accumulated_input); + ClassDB::bind_method(D_METHOD("flush_buffered_events"), &Input::flush_buffered_events); BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE); BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN); diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 37e8839cef7..b8f17d5bae6 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -37,6 +37,13 @@ Adds a new mapping entry (in SDL2 format) to the mapping database. Optionally update already connected devices. + + + + Sends all input events which are in the current buffer to the game loop. These events may have been buffered as a result of accumulated input ([method set_use_accumulated_input]) or agile input flushing ([member ProjectSettings.input_devices/buffering/agile_event_flushing]). + The engine will already do this itself at key execution points (at least once per frame). However, this can be useful in advanced cases where you want precise control over the timing of event handling. + +