World/Debug: Properly check the MapEdit status
If a Dear ImGui window is collapsed or closed, ImGui::Begin returns false. Check it properly to bypass rendering if is indeed not needed.
This commit is contained in:
parent
43970df494
commit
66ec111f5d
1 changed files with 65 additions and 64 deletions
|
@ -274,7 +274,7 @@ void World::step(const float& stepTime) {
|
||||||
player.rotate(player.currentRotationSpeed*stepTime);
|
player.rotate(player.currentRotationSpeed*stepTime);
|
||||||
|
|
||||||
#ifdef IMGUI
|
#ifdef IMGUI
|
||||||
ImGui::Begin("MapEdit");
|
if (ImGui::Begin("MapEdit")) {
|
||||||
static int blockToPlace = 1;
|
static int blockToPlace = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -325,7 +325,8 @@ void World::step(const float& stepTime) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Header, blockColor);
|
ImGui::PushStyleColor(ImGuiCol_Header, blockColor);
|
||||||
|
|
||||||
if (ImGui::Selectable("", currentBlock != BlockType::AIR, 0, ImVec2(10, 10))) {
|
if (ImGui::Selectable("", currentBlock != BlockType::AIR, 0, ImVec2(10, 10))) {
|
||||||
map[x + w*y] = currentBlock == (BlockType)blockToPlace ? BlockType::AIR : (BlockType)blockToPlace;
|
map[x + w * y] =
|
||||||
|
currentBlock == (BlockType) blockToPlace ? BlockType::AIR : (BlockType) blockToPlace;
|
||||||
}
|
}
|
||||||
ImGui::PopStyleColor(2);
|
ImGui::PopStyleColor(2);
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
@ -342,7 +343,7 @@ void World::step(const float& stepTime) {
|
||||||
ImGui::RadioButton("Window", &blockToPlace, (int) BlockType::WINDOW);
|
ImGui::RadioButton("Window", &blockToPlace, (int) BlockType::WINDOW);
|
||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue