From 888f451691dafded70e5dfc51bd558e8a4e12cb8 Mon Sep 17 00:00:00 2001 From: Prune Juice <118036786+tylerandari13@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:34:21 -0500 Subject: [PATCH] Add "Show Tile Ids In Editor" to debug menu. (#3015) A feature I've wanted for a while, and also useful to people who work on tilesets frequently. --- src/editor/tilebox.cpp | 3 ++- src/supertux/debug.cpp | 1 + src/supertux/debug.hpp | 2 ++ src/supertux/menu/debug_menu.cpp | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/editor/tilebox.cpp b/src/editor/tilebox.cpp index a5264872918..fc63e1ba612 100644 --- a/src/editor/tilebox.cpp +++ b/src/editor/tilebox.cpp @@ -22,6 +22,7 @@ #include "editor/tile_selection.hpp" #include "editor/tip.hpp" #include "supertux/colorscheme.hpp" +#include "supertux/debug.hpp" #include "supertux/gameconfig.hpp" #include "supertux/game_object_factory.hpp" #include "supertux/globals.hpp" @@ -108,7 +109,7 @@ EditorTilebox::draw_tilegroup(DrawingContext& context) auto position = get_tile_coords(pos, false); m_editor.get_tileset()->get(tile_ID).draw(context.color(), position, LAYER_GUI - 9); - if (g_config->developer_mode && m_active_tilegroup->developers_group) + if (g_config->developer_mode && (m_active_tilegroup->developers_group || g_debug.show_toolbox_tile_ids) && tile_ID != 0) { // Display tile ID on top of tile: context.color().draw_text(Resources::console_font, std::to_string(tile_ID), diff --git a/src/supertux/debug.cpp b/src/supertux/debug.cpp index 82f33215627..14f41dc11c0 100644 --- a/src/supertux/debug.cpp +++ b/src/supertux/debug.cpp @@ -25,6 +25,7 @@ Debug::Debug() : show_collision_rects(false), show_worldmap_path(false), draw_redundant_frames(false), + show_toolbox_tile_ids(false), m_use_bitmap_fonts(false), m_game_speed_multiplier(1.0f) { diff --git a/src/supertux/debug.hpp b/src/supertux/debug.hpp index 6ef8c46e784..8d49f8a8893 100644 --- a/src/supertux/debug.hpp +++ b/src/supertux/debug.hpp @@ -39,6 +39,8 @@ class Debug // vaguely measure the impact of code changes which should increase the FPS bool draw_redundant_frames; + bool show_toolbox_tile_ids; + private: /** Use old bitmap fonts instead of TTF */ bool m_use_bitmap_fonts; diff --git a/src/supertux/menu/debug_menu.cpp b/src/supertux/menu/debug_menu.cpp index 377732871c1..1461c19bb13 100644 --- a/src/supertux/menu/debug_menu.cpp +++ b/src/supertux/menu/debug_menu.cpp @@ -71,6 +71,7 @@ DebugMenu::DebugMenu() : add_toggle(-1, _("Use Bitmap Fonts"), []{ return g_debug.get_use_bitmap_fonts(); }, [](bool value){ g_debug.set_use_bitmap_fonts(value); }); + add_toggle(-1, _("Show Tile IDs in Editor Toolbox"), &g_debug.show_toolbox_tile_ids); add_entry(_("Dump Texture Cache"), []{ TextureManager::current()->debug_print(get_logging_instance()); }); add_hl();