mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +00:00
add 'Show Generator Minimap' checkbox
This commit is contained in:
parent
dc8bad2af6
commit
80e48ae302
3 changed files with 19 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
#include "delegates.hpp"
|
#include "delegates.hpp"
|
||||||
#include "engine.hpp"
|
#include "engine.hpp"
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
|
#include "hud.hpp"
|
||||||
#include "content/Content.hpp"
|
#include "content/Content.hpp"
|
||||||
#include "graphics/core/Mesh.hpp"
|
#include "graphics/core/Mesh.hpp"
|
||||||
#include "graphics/ui/elements/CheckBox.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
|
||||||
|
// TODO: move to xml finally
|
||||||
std::shared_ptr<UINode> create_debug_panel(
|
std::shared_ptr<UINode> create_debug_panel(
|
||||||
Engine* engine,
|
Engine* engine,
|
||||||
Level* level,
|
Level* level,
|
||||||
|
|
@ -213,6 +215,18 @@ std::shared_ptr<UINode> create_debug_panel(
|
||||||
});
|
});
|
||||||
panel->add(checkbox);
|
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();
|
panel->refresh();
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@
|
||||||
|
|
||||||
using namespace gui;
|
using namespace gui;
|
||||||
|
|
||||||
|
bool Hud::showGeneratorMinimap = false;
|
||||||
|
|
||||||
// implemented in debug_panel.cpp
|
// implemented in debug_panel.cpp
|
||||||
extern std::shared_ptr<UINode> create_debug_panel(
|
extern std::shared_ptr<UINode> create_debug_panel(
|
||||||
Engine* engine,
|
Engine* engine,
|
||||||
|
|
@ -361,7 +363,7 @@ void Hud::update(bool visible) {
|
||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
if (player->debug) {
|
if (player->debug && showGeneratorMinimap) {
|
||||||
updateWorldGenDebugVisualization();
|
updateWorldGenDebugVisualization();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,8 @@ public:
|
||||||
|
|
||||||
std::shared_ptr<Inventory> getBlockInventory();
|
std::shared_ptr<Inventory> getBlockInventory();
|
||||||
|
|
||||||
|
static bool showGeneratorMinimap;
|
||||||
|
|
||||||
/// @brief Runtime updating debug visualization texture
|
/// @brief Runtime updating debug visualization texture
|
||||||
inline static std::string DEBUG_WORLDGEN_IMAGE = "#debug.img.worldgen";
|
inline static std::string DEBUG_WORLDGEN_IMAGE = "#debug.img.worldgen";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue