diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-07-10 12:41:57 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-10 12:41:57 -0300 |
commit | 0e6e0ed0e5b8f41b20c087f3acb3a5ebb0836e60 (patch) | |
tree | 4fd957bded02d11f610f11dfac7f82dd66b2bc00 /main/input_default.cpp | |
parent | 28641fd9b8e73b3fae57ea4ccf0356629507ea3a (diff) | |
parent | 91add16300de38adf1e95728055c3e28f36ec182 (diff) |
Merge pull request #5533 from Hinsbart/cursor_atex
Can use AtlasTextures as custom mouse cursor.
Diffstat (limited to 'main/input_default.cpp')
-rw-r--r-- | main/input_default.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp index 4fcb450bce..e975d4141f 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -30,6 +30,7 @@ #include "servers/visual_server.h" #include "os/os.h" #include "input_map.h" +#include "scene/resources/texture.h" void InputDefault::SpeedTrack::update(const Vector2& p_delta_p) { @@ -463,9 +464,11 @@ void InputDefault::set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_ set_mouse_mode(MOUSE_MODE_VISIBLE); VisualServer::get_singleton()->cursor_set_visible(false); } else { + Ref<AtlasTexture> atex = custom_cursor; + Rect2 region = atex.is_valid() ? atex->get_region() : Rect2(); set_mouse_mode(MOUSE_MODE_HIDDEN); VisualServer::get_singleton()->cursor_set_visible(true); - VisualServer::get_singleton()->cursor_set_texture(custom_cursor->get_rid(),p_hotspot); + VisualServer::get_singleton()->cursor_set_texture(custom_cursor->get_rid(),p_hotspot, 0, region); VisualServer::get_singleton()->cursor_set_pos(get_mouse_pos()); } } |