|
@@ -4448,12 +4448,13 @@ void VisualServerRaster::cursor_set_rotation(float p_rotation, int p_cursor) {
|
|
cursors[p_cursor].rot = p_rotation;
|
|
cursors[p_cursor].rot = p_rotation;
|
|
};
|
|
};
|
|
|
|
|
|
-void VisualServerRaster::cursor_set_texture(RID p_texture, const Point2 &p_center_offset, int p_cursor) {
|
|
|
|
|
|
+void VisualServerRaster::cursor_set_texture(RID p_texture, const Point2 &p_center_offset, int p_cursor, const Rect2 &p_region) {
|
|
VS_CHANGED;
|
|
VS_CHANGED;
|
|
ERR_FAIL_INDEX(p_cursor, MAX_CURSORS);
|
|
ERR_FAIL_INDEX(p_cursor, MAX_CURSORS);
|
|
|
|
|
|
cursors[p_cursor].texture = p_texture;
|
|
cursors[p_cursor].texture = p_texture;
|
|
cursors[p_cursor].center = p_center_offset;
|
|
cursors[p_cursor].center = p_center_offset;
|
|
|
|
+ cursors[p_cursor].region = p_region;
|
|
};
|
|
};
|
|
|
|
|
|
void VisualServerRaster::cursor_set_visible(bool p_visible, int p_cursor) {
|
|
void VisualServerRaster::cursor_set_visible(bool p_visible, int p_cursor) {
|
|
@@ -7530,8 +7531,13 @@ void VisualServerRaster::_draw_cursors_and_margins() {
|
|
|
|
|
|
RID tex = cursors[i].texture?cursors[i].texture:default_cursor_texture;
|
|
RID tex = cursors[i].texture?cursors[i].texture:default_cursor_texture;
|
|
ERR_CONTINUE( !tex );
|
|
ERR_CONTINUE( !tex );
|
|
- Point2 size(texture_get_width(tex), texture_get_height(tex));
|
|
|
|
- rasterizer->canvas_draw_rect(Rect2(cursors[i].pos, size), 0, Rect2(), tex, Color(1, 1, 1, 1));
|
|
|
|
|
|
+ if (cursors[i].region.has_no_area()) {
|
|
|
|
+ Point2 size(texture_get_width(tex), texture_get_height(tex));
|
|
|
|
+ rasterizer->canvas_draw_rect(Rect2(cursors[i].pos, size), 0, Rect2(), tex, Color(1, 1, 1, 1));
|
|
|
|
+ } else {
|
|
|
|
+ Point2 size = cursors[i].region.size;
|
|
|
|
+ rasterizer->canvas_draw_rect(Rect2(cursors[i].pos, size), Rasterizer::CANVAS_RECT_REGION, cursors[i].region, tex, Color(1, 1, 1, 1));
|
|
|
|
+ }
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|