From fe00aa13057b784e1ed8b1f73690ce004eabb899 Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Tue, 7 Apr 2026 20:43:31 +0800 Subject: [PATCH] Remove XCUI demo panel from editor --- editor/CMakeLists.txt | 1 - .../xcui_demo/xcui_demo_theme.xctheme | 23 --- .../resources/xcui_demo/xcui_demo_view.xcui | 33 ----- editor/src/Core/EditorWorkspace.h | 2 - editor/src/panels/XCUIDemoPanel.cpp | 140 ------------------ editor/src/panels/XCUIDemoPanel.h | 20 --- 6 files changed, 219 deletions(-) delete mode 100644 editor/resources/xcui_demo/xcui_demo_theme.xctheme delete mode 100644 editor/resources/xcui_demo/xcui_demo_view.xcui delete mode 100644 editor/src/panels/XCUIDemoPanel.cpp delete mode 100644 editor/src/panels/XCUIDemoPanel.h diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 50e6c2c4..2a056797 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -100,7 +100,6 @@ add_executable(${PROJECT_NAME} WIN32 src/panels/InspectorPanel.cpp src/panels/ConsolePanel.cpp src/panels/ProjectPanel.cpp - src/panels/XCUIDemoPanel.cpp src/UI/BuiltInIcons.cpp src/Layers/EditorLayer.cpp ${IMGUI_SOURCES} diff --git a/editor/resources/xcui_demo/xcui_demo_theme.xctheme b/editor/resources/xcui_demo/xcui_demo_theme.xctheme deleted file mode 100644 index c4c1b784..00000000 --- a/editor/resources/xcui_demo/xcui_demo_theme.xctheme +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/editor/resources/xcui_demo/xcui_demo_view.xcui b/editor/resources/xcui_demo/xcui_demo_view.xcui deleted file mode 100644 index b151dbf9..00000000 --- a/editor/resources/xcui_demo/xcui_demo_view.xcui +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/editor/src/Core/EditorWorkspace.h b/editor/src/Core/EditorWorkspace.h index 5524149d..abc44d82 100644 --- a/editor/src/Core/EditorWorkspace.h +++ b/editor/src/Core/EditorWorkspace.h @@ -12,7 +12,6 @@ #include "panels/PanelCollection.h" #include "panels/ProjectPanel.h" #include "panels/SceneViewPanel.h" -#include "panels/XCUIDemoPanel.h" #include @@ -35,7 +34,6 @@ public: m_panels.Emplace(); m_panels.Emplace(); m_projectPanel = &m_panels.Emplace(); - m_panels.Emplace(); m_dockLayoutController = std::make_unique(); m_projectPanel->Initialize(context.GetProjectPath()); diff --git a/editor/src/panels/XCUIDemoPanel.cpp b/editor/src/panels/XCUIDemoPanel.cpp deleted file mode 100644 index 9b6e41de..00000000 --- a/editor/src/panels/XCUIDemoPanel.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include "XCUIDemoPanel.h" - -#include "UI/UI.h" - -#include - -#include - -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 diff --git a/editor/src/panels/XCUIDemoPanel.h b/editor/src/panels/XCUIDemoPanel.h deleted file mode 100644 index 49cea95b..00000000 --- a/editor/src/panels/XCUIDemoPanel.h +++ /dev/null @@ -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