Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug option to hide player HUD (including LevelTime counter) #3149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/object/level_time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "editor/editor.hpp"
#include "object/player.hpp"
#include "supertux/debug.hpp"
#include "supertux/game_session.hpp"
#include "supertux/resources.hpp"
#include "supertux/sector.hpp"
Expand Down Expand Up @@ -104,8 +105,9 @@ LevelTime::update(float dt_sec)
void
LevelTime::draw(DrawingContext& context)
{
if (Editor::is_active())
if (g_debug.hide_player_hud || Editor::is_active())
return;

context.push_transform();
context.set_translation(Vector(0, 0));
context.transform().scale = 1.f;
Expand Down
1 change: 1 addition & 0 deletions src/supertux/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Debug::Debug() :
show_worldmap_path(false),
draw_redundant_frames(false),
show_toolbox_tile_ids(false),
hide_player_hud(false),
m_use_bitmap_fonts(false),
m_game_speed_multiplier(1.0f)
{
Expand Down
4 changes: 4 additions & 0 deletions src/supertux/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ class Debug
// vaguely measure the impact of code changes which should increase the FPS
bool draw_redundant_frames;

/** Draw tile IDs in editor toolbox */
bool show_toolbox_tile_ids;

/** Do not draw PlayerStatusHUD and LevelTime */
bool hide_player_hud;

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 @@ -74,6 +74,7 @@ DebugMenu::DebugMenu() :
[]{ 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_toggle(-1, _("Hide Player HUD"), &g_debug.hide_player_hud);

add_entry(_("Reload Resources"), &Resources::reload_all)
.set_help(_("Reloads all fonts, textures, sprites and tilesets."));
Expand Down
3 changes: 2 additions & 1 deletion src/supertux/player_status_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <iostream>

#include "sprite/sprite_manager.hpp"
#include "supertux/debug.hpp"
#include "supertux/game_object.hpp"
#include "supertux/level.hpp"
#include "supertux/player_status.hpp"
Expand Down Expand Up @@ -60,7 +61,7 @@ PlayerStatusHUD::update(float dt_sec)
void
PlayerStatusHUD::draw(DrawingContext& context)
{
if (Editor::is_active())
if (g_debug.hide_player_hud || Editor::is_active())
return;

if ((displayed_coins == DISPLAYED_COINS_UNSET) ||
Expand Down
Loading