Skip to content

Commit

Permalink
Add "Show Tile Ids In Editor" to debug menu. (#3015)
Browse files Browse the repository at this point in the history
A feature I've wanted for a while, and also useful to people who work on
tilesets frequently.
  • Loading branch information
tylerandari13 authored Jul 25, 2024
1 parent fdd3ad0 commit 888f451
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/editor/tilebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions src/supertux/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions src/supertux/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/supertux/menu/debug_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 888f451

Please sign in to comment.