Refactor editor dock and panel chrome styling

This commit is contained in:
2026-03-26 16:43:06 +08:00
parent e174862b8a
commit 45842e961e
13 changed files with 623 additions and 328 deletions

View File

@@ -1,6 +1,6 @@
#include "GameViewPanel.h"
#include "UI/PanelChrome.h"
#include <imgui.h>
#include <imgui_internal.h>
namespace XCEngine {
namespace Editor {
@@ -8,25 +8,8 @@ namespace Editor {
GameViewPanel::GameViewPanel() : Panel("Game") {}
void GameViewPanel::Render() {
ImGui::Begin(m_name.c_str(), nullptr, ImGuiWindowFlags_None);
RenderGameView();
ImGui::End();
}
void GameViewPanel::RenderGameView() {
ImVec2 canvasSize = ImGui::GetContentRegionAvail();
ImDrawList* drawList = ImGui::GetWindowDrawList();
ImVec2 canvasPos = ImGui::GetCursorScreenPos();
ImU32 bgColor = IM_COL32(20, 20, 25, 255);
drawList->AddRectFilled(canvasPos, ImVec2(canvasPos.x + canvasSize.x, canvasPos.y + canvasSize.y), bgColor);
const char* text = "Game View (Press Play)";
ImVec2 textSize = ImGui::CalcTextSize(text);
ImVec2 textPos(canvasPos.x + (canvasSize.x - textSize.x) * 0.5f, canvasPos.y + (canvasSize.y - textSize.y) * 0.5f);
drawList->AddText(textPos, IM_COL32(128, 128, 128, 255), text);
UI::PanelWindowScope panel(m_name.c_str());
(void)panel;
}
}