fix: debug panel - block name out of panel

This commit is contained in:
MihailRis 2024-05-31 11:42:09 +03:00
parent 86dd6562de
commit 3e0455358a
2 changed files with 11 additions and 6 deletions

View File

@ -74,21 +74,25 @@ std::shared_ptr<UINode> create_debug_panel(
}));
panel->add(create_label([=](){
auto* indices = level->content->getIndices();
auto def = indices->getBlockDef(player->selectedVoxel.id);
std::wstringstream stream;
stream << "r:" << player->selectedVoxel.state.rotation << " s:"
<< player->selectedVoxel.state.segment << " u:"
<< std::bitset<8>(player->selectedVoxel.state.userbits);
if (def) {
stream << L" (" << util::str2wstr_utf8(def->name) << L")";
}
if (player->selectedVoxel.id == BLOCK_VOID) {
return std::wstring {L"block: none"};
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"};
}
}));
panel->add(create_label([=](){
return L"seed: "+std::to_wstring(level->getWorld()->getSeed());
}));

View File

@ -12,7 +12,7 @@ inline constexpr int BLOCK_DIR_DOWN = 0x5;
struct blockstate {
uint8_t rotation : 3;
uint8_t segment : 2;
uint8_t segment : 2; // planned to 0.22
uint8_t reserved : 3;
uint8_t userbits : 8;
};
@ -38,5 +38,6 @@ struct voxel {
blockid_t id;
blockstate state;
};
static_assert(sizeof(voxel) == 4);
#endif // VOXELS_VOXEL_HPP_