summaryrefslogtreecommitdiff
path: root/editor/plugins/tiles
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-11-17 18:43:31 +0100
committerRĂ©mi Verschelde <rverschelde@gmail.com>2023-05-12 12:07:14 +0200
commit64b15c8ec1d3764c5b56f351ae663cd4ac705b9d (patch)
tree511ecc01a01253b4e5c94b50a12b9713c8de61f8 /editor/plugins/tiles
parent3a90fa677b182c593213b229f7954dda6884aa78 (diff)
Add info label to TileMap editor
(cherry picked from commit 979b53aba49b2ff76fb8db540f948ce503c91b2b)
Diffstat (limited to 'editor/plugins/tiles')
-rw-r--r--editor/plugins/tiles/tile_map_editor.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp
index 55b5abf983..0a8ccdba1a 100644
--- a/editor/plugins/tiles/tile_map_editor.cpp
+++ b/editor/plugins/tiles/tile_map_editor.cpp
@@ -938,6 +938,20 @@ void TileMapEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p_over
}
}
}
+
+ Ref<Font> font = p_overlay->get_theme_font(SNAME("font"), SNAME("Label"));
+ int font_size = p_overlay->get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ Point2 msgpos = Point2(20 * EDSCALE, p_overlay->get_size().y - 20 * EDSCALE);
+
+ String text = tile_map->local_to_map(tile_map->get_local_mouse_position());
+ if (drag_type == DRAG_TYPE_RECT) {
+ Vector2i size = tile_map->local_to_map(tile_map->get_local_mouse_position()) - tile_map->local_to_map(drag_start_mouse_pos);
+ text += vformat(" %s (%dx%d)", TTR("Drawing Rect:"), ABS(size.x) + 1, ABS(size.y) + 1);
+ }
+
+ p_overlay->draw_string(font, msgpos + Point2(1, 1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
+ p_overlay->draw_string(font, msgpos + Point2(-1, -1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8));
+ p_overlay->draw_string(font, msgpos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 1));
}
}