Skip to content

Commit

Permalink
fix generator minimap checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Nov 7, 2024
1 parent cfa5365 commit 616c63b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/frontend/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ Hud::Hud(Engine* engine, LevelFrontend* frontend, Player* player)

assets->store(Texture::from(debugImgWorldGen.get()), DEBUG_WORLDGEN_IMAGE);

add(HudElement(hud_element_mode::permanent, nullptr,
guiutil::create(
debugMinimap = guiutil::create(
"<image src='"+DEBUG_WORLDGEN_IMAGE+
"' pos='0' size='256' gravity='top-right' margin='0,20,0,0'/>"
), true));
);
add(HudElement(hud_element_mode::permanent, nullptr, debugMinimap, true));
}

Hud::~Hud() {
Expand Down Expand Up @@ -367,6 +367,7 @@ void Hud::update(bool visible) {
}
cleanup();

debugMinimap->setVisible(player->debug && showGeneratorMinimap);
if (player->debug && showGeneratorMinimap) {
updateWorldGenDebugVisualization();
}
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/hud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class Hud : public util::ObjectsKeeper {
/// @brief UI element will be dynamicly positioned near to inventory or in screen center
std::shared_ptr<gui::UINode> secondUI = nullptr;

std::shared_ptr<gui::UINode> debugMinimap = nullptr;

std::unique_ptr<ImageData> debugImgWorldGen;

std::shared_ptr<gui::InventoryView> createContentAccess();
Expand Down

0 comments on commit 616c63b

Please sign in to comment.