add 'Show Generator Minimap' checkbox
This commit is contained in:
parent
dc8bad2af6
commit
80e48ae302
@ -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;
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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";
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user