minidef
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "Log.h"
|
||||
#include "Puzzle.h"
|
||||
#include "bx/string.h"
|
||||
#include "imgui.h"
|
||||
#include "rendering/Rendering.h"
|
||||
|
||||
#include "bx/bx.h"
|
||||
@@ -154,4 +156,47 @@ namespace Puzzle
|
||||
return (sourceType == PuzzleElementType::WaterIn && goalType == PuzzleElementType::WaterGoal) ||
|
||||
(sourceType == PuzzleElementType::ElectricIn && goalType == PuzzleElementType::ElectricGoal);
|
||||
}
|
||||
|
||||
bool PuzzleData::RenderDebugUI()
|
||||
{
|
||||
bool dataChanged = false;
|
||||
|
||||
bool isVisible = true;
|
||||
if (ImGui::Begin("Puzzle", &isVisible))
|
||||
{
|
||||
ImGui::Text("%s", PuzzleName);
|
||||
|
||||
int32_t W = S.WidthTiles;
|
||||
int32_t H = S.HeightTiles;
|
||||
ImGui::PushID("width");
|
||||
ImGui::SetNextItemWidth(40);
|
||||
if (ImGui::DragInt("", &W, 0.3f, 0, Config::MaxPuzzleSizeTiles))
|
||||
{
|
||||
S.WidthTiles = uint8_t(W);
|
||||
dataChanged = true;
|
||||
}
|
||||
ImGui::PopID();
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("x");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(40);
|
||||
ImGui::PushID("height");
|
||||
if (ImGui::DragInt("", &H, 0.3f, 0, Config::MaxPuzzleSizeTiles))
|
||||
{
|
||||
S.HeightTiles = uint8_t(H);
|
||||
dataChanged = true;
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::End();
|
||||
|
||||
if (dataChanged)
|
||||
{
|
||||
char path[128]{0};
|
||||
bx::snprintf(path, sizeof(path), "game/data/%s.pzl", PuzzleName);
|
||||
SerializeStruct(&S, sizeof(S), path);
|
||||
}
|
||||
|
||||
return isVisible;
|
||||
}
|
||||
} // namespace Puzzle
|
||||
|
||||
Reference in New Issue
Block a user