summaryrefslogtreecommitdiff
path: root/core/input
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-04 15:52:34 +0200
committerGitHub <noreply@github.com>2022-06-04 15:52:34 +0200
commitecde7ce8345a54becf65c166e1c9efc640e37837 (patch)
tree2b323e50ff9212d653e4b429c4fbeb728e2c6397 /core/input
parent7a5eba16d88f6e9445a5e68dee6456e2568ff1d1 (diff)
parentf16c33fff6b476a95aa44789df309ca19e43315e (diff)
Merge pull request #61669 from fire-forge/input
Make Input `mouse_mode` and `use_accumulated_input` properties
Diffstat (limited to 'core/input')
-rw-r--r--core/input/input.cpp8
-rw-r--r--core/input/input.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp
index dbb6bd8d9c..b3a68bb98c 100644
--- a/core/input/input.cpp
+++ b/core/input/input.cpp
@@ -134,8 +134,12 @@ 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("is_using_accumulated_input"), &Input::is_using_accumulated_input);
ClassDB::bind_method(D_METHOD("flush_buffered_events"), &Input::flush_buffered_events);
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "mouse_mode"), "set_mouse_mode", "get_mouse_mode");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_accumulated_input"), "set_use_accumulated_input", "is_using_accumulated_input");
+
BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE);
BIND_ENUM_CONSTANT(MOUSE_MODE_HIDDEN);
BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED);
@@ -897,6 +901,10 @@ void Input::set_use_accumulated_input(bool p_enable) {
use_accumulated_input = p_enable;
}
+bool Input::is_using_accumulated_input() {
+ return use_accumulated_input;
+}
+
void Input::release_pressed_events() {
flush_buffered_events(); // this is needed to release actions strengths
diff --git a/core/input/input.h b/core/input/input.h
index 35812604b2..f02f2abae5 100644
--- a/core/input/input.h
+++ b/core/input/input.h
@@ -327,6 +327,7 @@ public:
bool is_using_input_buffering();
void set_use_input_buffering(bool p_enable);
void set_use_accumulated_input(bool p_enable);
+ bool is_using_accumulated_input();
void release_pressed_events();