Remove XCUI demo panel from editor
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
#include "panels/PanelCollection.h"
|
||||
#include "panels/ProjectPanel.h"
|
||||
#include "panels/SceneViewPanel.h"
|
||||
#include "panels/XCUIDemoPanel.h"
|
||||
|
||||
#include <XCEngine/Core/Asset/ResourceManager.h>
|
||||
|
||||
@@ -35,7 +34,6 @@ public:
|
||||
m_panels.Emplace<InspectorPanel>();
|
||||
m_panels.Emplace<ConsolePanel>();
|
||||
m_projectPanel = &m_panels.Emplace<ProjectPanel>();
|
||||
m_panels.Emplace<XCUIDemoPanel>();
|
||||
m_dockLayoutController = std::make_unique<DockLayoutController>();
|
||||
|
||||
m_projectPanel->Initialize(context.GetProjectPath());
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
#include "XCUIDemoPanel.h"
|
||||
|
||||
#include "UI/UI.h"
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
namespace {
|
||||
|
||||
::XCEngine::UI::UIDrawList BuildXCUIDemoDrawList(
|
||||
const ImVec2& canvasMin,
|
||||
const ImVec2& canvasSize) {
|
||||
using ::XCEngine::UI::UIColor;
|
||||
using ::XCEngine::UI::UIDrawList;
|
||||
using ::XCEngine::UI::UIPoint;
|
||||
using ::XCEngine::UI::UIRect;
|
||||
|
||||
UIDrawList drawList("XCUI Transition Demo");
|
||||
drawList.PushClipRect(UIRect(canvasMin.x, canvasMin.y, canvasSize.x, canvasSize.y));
|
||||
drawList.AddFilledRect(
|
||||
UIRect(canvasMin.x, canvasMin.y, canvasSize.x, canvasSize.y),
|
||||
UIColor(0.09f, 0.11f, 0.14f, 1.0f),
|
||||
10.0f);
|
||||
drawList.AddRectOutline(
|
||||
UIRect(canvasMin.x, canvasMin.y, canvasSize.x, canvasSize.y),
|
||||
UIColor(0.32f, 0.40f, 0.49f, 1.0f),
|
||||
1.0f,
|
||||
10.0f);
|
||||
|
||||
const float cardX = canvasMin.x + 18.0f;
|
||||
const float cardY = canvasMin.y + 18.0f;
|
||||
const float cardWidth = (canvasSize.x - 36.0f) > 120.0f ? (canvasSize.x - 36.0f) : 120.0f;
|
||||
drawList.AddFilledRect(
|
||||
UIRect(cardX, cardY, cardWidth, 56.0f),
|
||||
UIColor(0.15f, 0.20f, 0.27f, 1.0f),
|
||||
8.0f);
|
||||
drawList.AddFilledRect(
|
||||
UIRect(cardX + 14.0f, cardY + 16.0f, 10.0f, 10.0f),
|
||||
UIColor(0.18f, 0.76f, 0.58f, 1.0f),
|
||||
5.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(cardX + 32.0f, cardY + 12.0f),
|
||||
"XCUI Transition Backend",
|
||||
UIColor(0.96f, 0.97f, 0.99f, 1.0f),
|
||||
18.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(cardX + 32.0f, cardY + 33.0f),
|
||||
"This panel is generated by XCUI draw commands, then flushed through ImGui.",
|
||||
UIColor(0.74f, 0.79f, 0.86f, 1.0f),
|
||||
13.0f);
|
||||
|
||||
const float statY = cardY + 76.0f;
|
||||
drawList.AddFilledRect(
|
||||
UIRect(cardX, statY, 140.0f, 74.0f),
|
||||
UIColor(0.11f, 0.16f, 0.22f, 1.0f),
|
||||
8.0f);
|
||||
drawList.AddFilledRect(
|
||||
UIRect(cardX + 158.0f, statY, 180.0f, 74.0f),
|
||||
UIColor(0.11f, 0.16f, 0.22f, 1.0f),
|
||||
8.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(cardX + 14.0f, statY + 12.0f),
|
||||
"Primitive Set",
|
||||
UIColor(0.68f, 0.75f, 0.84f, 1.0f),
|
||||
13.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(cardX + 14.0f, statY + 36.0f),
|
||||
"Rect / Border / Text / Image",
|
||||
UIColor(0.95f, 0.97f, 0.99f, 1.0f),
|
||||
15.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(cardX + 172.0f, statY + 12.0f),
|
||||
"Backend Flow",
|
||||
UIColor(0.68f, 0.75f, 0.84f, 1.0f),
|
||||
13.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(cardX + 172.0f, statY + 36.0f),
|
||||
"UIDrawList -> ImGuiTransitionBackend -> ImDrawList",
|
||||
UIColor(0.95f, 0.97f, 0.99f, 1.0f),
|
||||
15.0f);
|
||||
|
||||
const float footerY = canvasMin.y + canvasSize.y - 54.0f;
|
||||
if (footerY > statY + 90.0f) {
|
||||
drawList.AddFilledRect(
|
||||
UIRect(cardX, footerY, cardWidth, 36.0f),
|
||||
UIColor(0.14f, 0.17f, 0.22f, 1.0f),
|
||||
8.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(cardX + 14.0f, footerY + 10.0f),
|
||||
"Subplan-05 MVP: XCUI owns draw data, ImGui is only the transition renderer.",
|
||||
UIColor(0.79f, 0.84f, 0.90f, 1.0f),
|
||||
13.0f);
|
||||
}
|
||||
|
||||
drawList.PopClipRect();
|
||||
return drawList;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
XCUIDemoPanel::XCUIDemoPanel()
|
||||
: Panel("XCUI Demo") {
|
||||
}
|
||||
|
||||
void XCUIDemoPanel::Render() {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
UI::PanelWindowScope panel(m_name.c_str());
|
||||
ImGui::PopStyleVar();
|
||||
if (!panel.IsOpen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
UI::PanelContentScope content("XCUIDemoContent", ImVec2(0.0f, 0.0f));
|
||||
if (!content.IsOpen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ImVec2 availableSize = ImGui::GetContentRegionAvail();
|
||||
if (availableSize.x <= 1.0f || availableSize.y <= 1.0f) {
|
||||
ImGui::Dummy(ImVec2(0.0f, 0.0f));
|
||||
return;
|
||||
}
|
||||
|
||||
const ImVec2 canvasMin = ImGui::GetCursorScreenPos();
|
||||
ImGui::InvisibleButton("##XCUIDemoCanvas", availableSize);
|
||||
|
||||
::XCEngine::UI::UIDrawData drawData = {};
|
||||
drawData.AddDrawList(BuildXCUIDemoDrawList(canvasMin, availableSize));
|
||||
|
||||
m_backend.BeginFrame();
|
||||
m_backend.Submit(drawData);
|
||||
m_backend.EndFrame(ImGui::GetWindowDrawList());
|
||||
}
|
||||
|
||||
} // namespace Editor
|
||||
} // namespace XCEngine
|
||||
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Panel.h"
|
||||
|
||||
#include "XCUIBackend/ImGuiTransitionBackend.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Editor {
|
||||
|
||||
class XCUIDemoPanel : public Panel {
|
||||
public:
|
||||
XCUIDemoPanel();
|
||||
void Render() override;
|
||||
|
||||
private:
|
||||
XCUIBackend::ImGuiTransitionBackend m_backend;
|
||||
};
|
||||
|
||||
} // namespace Editor
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user