diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-01-03 08:35:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-03 08:35:59 +0100 |
commit | 6322b0bbb7fec1e6574f0bb09c99647472ef3a52 (patch) | |
tree | 235aab52e666b4619c940bb1765a76ad2649cfc7 /core/os | |
parent | 2c226e4edf720ebbadf355e244b27082ca01f330 (diff) | |
parent | a392dbdbe3f67d42698e47399421fbdf6ae5c90a (diff) |
Merge pull request #12814 from guilhermefelipecgs/add_hardware_custom_cursor
Custom hardware-accelerated mouse cursor
Diffstat (limited to 'core/os')
-rw-r--r-- | core/os/input.cpp | 20 | ||||
-rw-r--r-- | core/os/input.h | 25 | ||||
-rw-r--r-- | core/os/os.h | 1 |
3 files changed, 44 insertions, 2 deletions
diff --git a/core/os/input.cpp b/core/os/input.cpp index 2795b11243..a44adde425 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -84,7 +84,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("warp_mouse_position", "to"), &Input::warp_mouse_position); 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", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2())); + 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); BIND_ENUM_CONSTANT(MOUSE_MODE_VISIBLE); @@ -92,6 +92,24 @@ void Input::_bind_methods() { BIND_ENUM_CONSTANT(MOUSE_MODE_CAPTURED); BIND_ENUM_CONSTANT(MOUSE_MODE_CONFINED); + BIND_ENUM_CONSTANT(CURSOR_ARROW); + BIND_ENUM_CONSTANT(CURSOR_IBEAM); + BIND_ENUM_CONSTANT(CURSOR_POINTING_HAND); + BIND_ENUM_CONSTANT(CURSOR_CROSS); + BIND_ENUM_CONSTANT(CURSOR_WAIT); + BIND_ENUM_CONSTANT(CURSOR_BUSY); + BIND_ENUM_CONSTANT(CURSOR_DRAG); + BIND_ENUM_CONSTANT(CURSOR_CAN_DROP); + BIND_ENUM_CONSTANT(CURSOR_FORBIDDEN); + BIND_ENUM_CONSTANT(CURSOR_VSIZE); + BIND_ENUM_CONSTANT(CURSOR_HSIZE); + BIND_ENUM_CONSTANT(CURSOR_BDIAGSIZE); + BIND_ENUM_CONSTANT(CURSOR_FDIAGSIZE); + BIND_ENUM_CONSTANT(CURSOR_MOVE); + BIND_ENUM_CONSTANT(CURSOR_VSPLIT); + BIND_ENUM_CONSTANT(CURSOR_HSPLIT); + BIND_ENUM_CONSTANT(CURSOR_HELP); + ADD_SIGNAL(MethodInfo("joy_connection_changed", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "connected"))); } diff --git a/core/os/input.h b/core/os/input.h index 608484ccd0..140d11de4d 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -51,6 +51,28 @@ public: MOUSE_MODE_CONFINED }; +#undef CursorShape + enum CursorShape { + CURSOR_ARROW, + CURSOR_IBEAM, + CURSOR_POINTING_HAND, + CURSOR_CROSS, + CURSOR_WAIT, + CURSOR_BUSY, + CURSOR_DRAG, + CURSOR_CAN_DROP, + CURSOR_FORBIDDEN, + CURSOR_VSIZE, + CURSOR_HSIZE, + CURSOR_BDIAGSIZE, + CURSOR_FDIAGSIZE, + CURSOR_MOVE, + CURSOR_VSPLIT, + CURSOR_HSPLIT, + CURSOR_HELP, + CURSOR_MAX + }; + void set_mouse_mode(MouseMode p_mode); MouseMode get_mouse_mode() const; @@ -96,7 +118,7 @@ public: virtual bool is_emulating_touchscreen() const = 0; - virtual void set_custom_mouse_cursor(const RES &p_cursor, const Vector2 &p_hotspot = Vector2()) = 0; + virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()) = 0; virtual void set_mouse_in_window(bool p_in_window) = 0; virtual String get_joy_button_string(int p_button) = 0; @@ -110,5 +132,6 @@ public: }; VARIANT_ENUM_CAST(Input::MouseMode); +VARIANT_ENUM_CAST(Input::CursorShape); #endif // INPUT_H diff --git a/core/os/os.h b/core/os/os.h index 5dc39b52d6..c9c228cfaf 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -325,6 +325,7 @@ public: virtual int get_virtual_keyboard_height() const; virtual void set_cursor_shape(CursorShape p_shape) = 0; + virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) = 0; virtual bool get_swap_ok_cancel() { return false; } virtual void dump_memory_to_file(const char *p_file); |