This commit is contained in:
@clasher113
2024-06-07 00:51:18 +03:00
160 changed files with 2935 additions and 1724 deletions
+20 -9
View File
@@ -1,6 +1,7 @@
#include "../audio/audio.hpp"
#include "../delegates.hpp"
#include "../engine.hpp"
#include "../settings.hpp"
#include "../graphics/core/Mesh.hpp"
#include "../graphics/ui/elements/CheckBox.hpp"
#include "../graphics/ui/elements/TextBox.hpp"
@@ -19,6 +20,7 @@
#include <string>
#include <memory>
#include <sstream>
#include <bitset>
using namespace gui;
@@ -71,15 +73,24 @@ std::shared_ptr<UINode> create_debug_panel(
L" visible: "+std::to_wstring(level->chunks->visible);
}));
panel->add(create_label([=](){
auto* indices = level->content->getIndices();
auto def = indices->getBlockDef(player->selectedVoxel.id);
std::wstringstream stream;
stream << std::hex << player->selectedVoxel.states;
if (def) {
stream << L" (" << util::str2wstr_utf8(def->name) << L")";
stream << "r:" << player->selectedVoxel.state.rotation << " s:"
<< player->selectedVoxel.state.segment << " u:"
<< std::bitset<8>(player->selectedVoxel.state.userbits);
if (player->selectedVoxel.id == BLOCK_VOID) {
return std::wstring {L"block: -"};
} else {
return L"block: "+std::to_wstring(player->selectedVoxel.id)+
L" "+stream.str();
}
}));
panel->add(create_label([=](){
auto* indices = level->content->getIndices();
if (auto def = indices->getBlockDef(player->selectedVoxel.id)) {
return L"name: " + util::str2wstr_utf8(def->name);
} else {
return std::wstring {L"name: void"};
}
return L"block: "+std::to_wstring(player->selectedVoxel.id)+
L" "+stream.str();
}));
panel->add(create_label([=](){
return L"seed: "+std::to_wstring(level->getWorld()->getSeed());
@@ -137,8 +148,8 @@ std::shared_ptr<UINode> create_debug_panel(
}
{
auto bar = std::make_shared<TrackBar>(0.0f, 1.0f, 0.0f, 0.005f, 8);
bar->setSupplier([=]() {return WorldRenderer::fog;});
bar->setConsumer([=](double val) {WorldRenderer::fog = val;});
bar->setSupplier([=]() {return level->getWorld()->fog;});
bar->setConsumer([=](double val) {level->getWorld()->fog = val;});
panel->add(bar);
}
{