mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Input: bind parse_input_event()
When using get_tree().input_event(ev), the engine will JUST send the event down the SceneTree. However, you won't get any of the benefits of the Input singleton: - No InputMap actions will be emitted - The internal input state won't be modified, so methods like `Input.get_mouse_pos()` or `Input.is_joy_button_pressed` won't return the expected output after sending the event. This is fixed by using `Input.parse_input_event(ev)` instead. I guess we'll also have to update the docs to reflect that this is the preferred method of sending custom InputEvents.
This commit is contained in:
@@ -83,6 +83,7 @@ void Input::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("action_press", "action"), &Input::action_press);
|
||||
ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release);
|
||||
ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image:Texture", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2()));
|
||||
ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event);
|
||||
|
||||
BIND_CONSTANT(MOUSE_MODE_VISIBLE);
|
||||
BIND_CONSTANT(MOUSE_MODE_HIDDEN);
|
||||
|
||||
Reference in New Issue
Block a user