You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
[Input] Release keys/actions pressed if window loses focus
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com> Co-authored-by: Marcelo Fernandez <marcelofg55@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user