add 'Show Generator Minimap' checkbox

This commit is contained in:
MihailRis 2024-11-06 00:34:38 +03:00
parent dc8bad2af6
commit 80e48ae302
3 changed files with 19 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#include "delegates.hpp"
#include "engine.hpp"
#include "settings.hpp"
#include "hud.hpp"
#include "content/Content.hpp"
#include "graphics/core/Mesh.hpp"
#include "graphics/ui/elements/CheckBox.hpp"
@ -37,6 +38,7 @@ static std::shared_ptr<Label> create_label(wstringsupplier supplier) {
}
// TODO: move to xml
// TODO: move to xml finally
std::shared_ptr<UINode> create_debug_panel(
Engine* engine,
Level* level,
@ -213,6 +215,18 @@ std::shared_ptr<UINode> create_debug_panel(
});
panel->add(checkbox);
}
{
auto checkbox = std::make_shared<FullCheckBox>(
L"Show Generator Minimap", glm::vec2(400, 24)
);
checkbox->setSupplier([=]() {
return Hud::showGeneratorMinimap;
});
checkbox->setConsumer([=](bool checked) {
Hud::showGeneratorMinimap = checked;
});
panel->add(checkbox);
}
panel->refresh();
return panel;
}

View File

@ -56,6 +56,8 @@
using namespace gui;
bool Hud::showGeneratorMinimap = false;
// implemented in debug_panel.cpp
extern std::shared_ptr<UINode> create_debug_panel(
Engine* engine,
@ -361,7 +363,7 @@ void Hud::update(bool visible) {
}
cleanup();
if (player->debug) {
if (player->debug && showGeneratorMinimap) {
updateWorldGenDebugVisualization();
}
}

View File

@ -172,6 +172,8 @@ public:
std::shared_ptr<Inventory> getBlockInventory();
static bool showGeneratorMinimap;
/// @brief Runtime updating debug visualization texture
inline static std::string DEBUG_WORLDGEN_IMAGE = "#debug.img.worldgen";
};