card rotation
This commit is contained in:
@@ -23,7 +23,9 @@
|
||||
#include <thread>
|
||||
|
||||
#include "imgui-helper.h"
|
||||
#include "imgui-style.h"
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -371,6 +373,7 @@ namespace Game
|
||||
Materials[0] =
|
||||
Material::LoadFromShader("vert", "frag", MainViewID, Textures[0].Handle, Textures[0].SamplerHandle);
|
||||
imguiCreate();
|
||||
SetImguiStyle();
|
||||
|
||||
if (!ImGui_ImplSDL3_InitForOther(shared.Window.SDLWindow))
|
||||
{
|
||||
@@ -460,6 +463,11 @@ namespace Game
|
||||
auto& debug = GetInstance().DebugData;
|
||||
if (UIVisible == UIVisibilityState::Debug)
|
||||
{
|
||||
if (ImGui::IsMouseClicked(ImGuiMouseButton_Right))
|
||||
{
|
||||
debug.DebugCardRotation++;
|
||||
if (debug.DebugCardRotation >= 4) debug.DebugCardRotation = 0;
|
||||
}
|
||||
if (ImGui::Begin("Rendering"))
|
||||
{
|
||||
if (LastShaderLoadTime >= 0.0f)
|
||||
@@ -479,10 +487,18 @@ namespace Game
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Reload Level"))
|
||||
{
|
||||
auto& lvl = GetInstance().GameLevel;
|
||||
lvl = {};
|
||||
lvl.Setup(shared.Game);
|
||||
level = {};
|
||||
level.Setup(shared.Game);
|
||||
}
|
||||
ImGui::Checkbox("Show ImGui Demo", &debug.ShowImguiDemo);
|
||||
if (debug.ShowImguiDemo) ImGui::ShowDemoWindow(&debug.ShowImguiDemo);
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Cubes", &level.Cubes.IsEnabled);
|
||||
ImGui::Checkbox("Tests", &level.Tests.IsEnabled);
|
||||
ImGui::Checkbox("PuzzleTiles", &level.PuzzleTiles.IsEnabled);
|
||||
ImGui::Checkbox("UIQuads", &level.UIQuads.IsEnabled);
|
||||
|
||||
if (ImGui::Button("Dithergen"))
|
||||
{
|
||||
DitherGen(DitherTextures, DitherRecursion);
|
||||
@@ -568,22 +584,22 @@ namespace Game
|
||||
ImGui::End();
|
||||
if (debug.SelectedDebugLevel < BX_COUNTOF(level.Puzzles))
|
||||
{
|
||||
if (!Generated::RenderDebugUI(level.Puzzles[debug.SelectedDebugLevel].Data))
|
||||
if (!Puzzle::RenderDebugUI(level.Puzzles[debug.SelectedDebugLevel].Data))
|
||||
{
|
||||
debug.SelectedDebugLevel = UINT16_MAX;
|
||||
}
|
||||
}
|
||||
if (ImGui::Begin("Cards"))
|
||||
{
|
||||
Generated::StaticPuzzleData& staticData = Generated::GetStaticPuzzleData();
|
||||
Generated::StaticPuzzleData& staticData = Puzzle::GetStaticPuzzleData();
|
||||
if (ImGui::Button("Save"))
|
||||
{
|
||||
Generated::SaveStaticPuzzleData();
|
||||
Puzzle::SaveStaticPuzzleData();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Reload"))
|
||||
{
|
||||
Generated::LoadStaticPuzzleData();
|
||||
Puzzle::LoadStaticPuzzleData();
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < BX_COUNTOF(staticData.Cards); ++i)
|
||||
@@ -597,7 +613,7 @@ namespace Game
|
||||
ImGui::Selectable(cardName);
|
||||
if (ImGui::BeginDragDropSource())
|
||||
{
|
||||
ImGui::Text("Card %i", i);
|
||||
Puzzle::DrawCard(card, debug.DebugCardRotation, ImGui::GetCursorScreenPos());
|
||||
ImGui::SetDragDropPayload("cardtype", &i, sizeof(i));
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
@@ -610,7 +626,7 @@ namespace Game
|
||||
{
|
||||
if (x > 0) ImGui::SameLine();
|
||||
ImGui::PushID(x);
|
||||
auto& node = Generated::EditCardNodeAt(card, x, y);
|
||||
auto& node = Puzzle::EditCardNodeAt(card, 0, x, y);
|
||||
if (ImGui::Button(Generated::PuzzleElementType::ShortName[node], {26, 24}))
|
||||
{
|
||||
int32_t newVal = int32_t(node) + 1;
|
||||
|
||||
Reference in New Issue
Block a user