puzzle ids
This commit is contained in:
@@ -13,10 +13,12 @@
|
||||
#include "bx/constants.h"
|
||||
#include "bx/filepath.h"
|
||||
#include "bx/math.h"
|
||||
#include "bx/string.h"
|
||||
#include "bx/timer.h"
|
||||
#include <bgfx/bgfx.h>
|
||||
#include <bimg/bimg.h>
|
||||
#include <bx/file.h>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <thread>
|
||||
|
||||
@@ -505,18 +507,54 @@ namespace Game
|
||||
}
|
||||
Vec3 quadPos = level.UIQuads.Get({0}).EData.Transform.GetPosition();
|
||||
ImGui::Text("%f %f %f", quadPos.x, quadPos.y, quadPos.z);
|
||||
|
||||
if (ImGui::ColorEdit3("Base Color", &DefaultBaseColor.x))
|
||||
{
|
||||
auto& tiles = GetInstance().GameLevel.PuzzleTiles;
|
||||
for (int32_t i = 0; i < tiles.Count; ++i)
|
||||
{
|
||||
tiles.Data[i].EData.BaseColor = DefaultBaseColor;
|
||||
}
|
||||
}
|
||||
if (ImGui::ColorEdit3("Dot Color", &DefaultTileColor.x))
|
||||
{
|
||||
auto& tiles = GetInstance().GameLevel.PuzzleTiles;
|
||||
for (int32_t i = 0; i < tiles.Count; ++i)
|
||||
{
|
||||
tiles.Data[i].EData.TestColor = DefaultTileColor;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Shader log:");
|
||||
ImGui::TextWrapped("%s", GetShared().Dev.ShaderLog);
|
||||
}
|
||||
ImGui::End();
|
||||
if (ImGui::Begin("Puzzles"))
|
||||
{
|
||||
ImGui::Text("List");
|
||||
if (ImGui::Button("Add"))
|
||||
{
|
||||
bool found = false;
|
||||
for (int32_t i = 0; i < BX_COUNTOF(level.Puzzles); ++i)
|
||||
{
|
||||
auto& puz = level.Puzzles[i].Data;
|
||||
if (puz.ID == UINT16_MAX)
|
||||
{
|
||||
bx::strCopy(puz.PuzzleName, sizeof(puz.PuzzleName), "Unnamed Puzzle");
|
||||
puz.ID = i;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
LOG_ERROR("Too many puzzles!");
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
for (int32_t i = 0; i < BX_COUNTOF(level.Puzzles); ++i)
|
||||
{
|
||||
auto& puzzleData = level.Puzzles[i].Data;
|
||||
if (puzzleData.PuzzleName[0] == 0) continue;
|
||||
if (puzzleData.ID == UINT16_MAX) continue;
|
||||
|
||||
bool isSelected = debug.SelectedDebugLevel == i;
|
||||
ImGui::PushID("selectable");
|
||||
@@ -525,21 +563,16 @@ namespace Game
|
||||
debug.SelectedDebugLevel = isSelected ? UINT16_MAX : i;
|
||||
}
|
||||
ImGui::PopID();
|
||||
if (isSelected)
|
||||
{
|
||||
ImGui::PushID("edit field");
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
ImGui::InputText("", puzzleData.PuzzleName, sizeof(Generated::PuzzleData::PuzzleName));
|
||||
ImGui::PopID();
|
||||
|
||||
if (!Generated::RenderDebugUI(puzzleData))
|
||||
{
|
||||
debug.SelectedDebugLevel = UINT16_MAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
if (debug.SelectedDebugLevel < BX_COUNTOF(level.Puzzles))
|
||||
{
|
||||
if (!Generated::RenderDebugUI(level.Puzzles[debug.SelectedDebugLevel].Data))
|
||||
{
|
||||
debug.SelectedDebugLevel = UINT16_MAX;
|
||||
}
|
||||
}
|
||||
if (ImGui::Begin("Cards"))
|
||||
{
|
||||
Generated::StaticPuzzleData& staticData = Generated::GetStaticPuzzleData();
|
||||
@@ -559,7 +592,15 @@ namespace Game
|
||||
|
||||
Generated::StaticPuzzleCard& card = staticData.Cards[i];
|
||||
ImGui::PushID(i);
|
||||
ImGui::Text("%i", i);
|
||||
char cardName[64]{0};
|
||||
bx::snprintf(cardName, sizeof(cardName), "%i", i);
|
||||
ImGui::Selectable(cardName);
|
||||
if (ImGui::BeginDragDropSource())
|
||||
{
|
||||
ImGui::Text("Card %i", i);
|
||||
ImGui::SetDragDropPayload("cardtype", &i, sizeof(i));
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
|
||||
Tools::ModelDropdown(card.ModelHandle);
|
||||
for (int32_t y = 0; y < Puzzle::Config::CardSize; ++y)
|
||||
@@ -634,6 +675,7 @@ namespace Game
|
||||
mat.Uniforms[Material::UTime] = bgfx::createUniform("u_time", bgfx::UniformType::Vec4);
|
||||
mat.Uniforms[Material::UDotColor] = bgfx::createUniform("u_testColor", bgfx::UniformType::Vec4);
|
||||
mat.Uniforms[Material::UTexInfo] = bgfx::createUniform("u_texInfo", bgfx::UniformType::Vec4);
|
||||
mat.Uniforms[Material::UBaseColor] = bgfx::createUniform("u_baseColor", bgfx::UniformType::Vec4);
|
||||
mat.Textures[0].Handle = tex;
|
||||
mat.Textures[0].SamplerHandle = sampler;
|
||||
mat.ViewID = view;
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Game
|
||||
UTime = 0,
|
||||
UDotColor = 1,
|
||||
UTexInfo = 2,
|
||||
UBaseColor = 3,
|
||||
};
|
||||
|
||||
bgfx::ProgramHandle Shader;
|
||||
@@ -108,6 +109,8 @@ namespace Game
|
||||
uint16_t MainViewID = 10;
|
||||
float LastShaderLoadTime = 0.0f;
|
||||
int32_t DitherRecursion = 1;
|
||||
Vec4 DefaultBaseColor;
|
||||
Vec4 DefaultTileColor;
|
||||
|
||||
public:
|
||||
void Setup();
|
||||
|
||||
Reference in New Issue
Block a user