add temporary test block

This commit is contained in:
MihailRis
2024-06-08 21:42:44 +03:00
parent c2aa4e3c26
commit ee47213dbb
8 changed files with 45 additions and 4 deletions
+19
View File
@@ -31,6 +31,13 @@ static std::shared_ptr<Label> create_label(wstringsupplier supplier) {
return label;
}
template <size_t T>
inline std::wstring to_string(std::bitset<T> bs) {
std::wstringstream ss;
ss << bs;
return ss.str();
}
std::shared_ptr<UINode> create_debug_panel(
Engine* engine,
Level* level,
@@ -94,6 +101,18 @@ std::shared_ptr<UINode> create_debug_panel(
return std::wstring {L"name: void"};
}
}));
panel->add(create_label([=](){
auto* indices = level->content->getIndices();
if (auto def = indices->getBlockDef(player->selectedVoxel.id)) {
return L"light: " + to_string(std::bitset<16>(level->chunks->getLight(
player->actualSelectedBlockPosition.x,
player->actualSelectedBlockPosition.y,
player->actualSelectedBlockPosition.z
)));
} else {
return std::wstring {L"no light: -"};
}
}));
panel->add(create_label([=](){
return L"seed: "+std::to_wstring(level->getWorld()->getSeed());
}));