Refactor new editor host orchestration

This commit is contained in:
2026-04-13 19:37:10 +08:00
parent d2140bf5cc
commit f3fc34898a
9 changed files with 648 additions and 223 deletions

View File

@@ -6,6 +6,8 @@
#include <Host/AutoScreenshot.h>
#include <Host/D3D12WindowRenderer.h>
#include <Host/D3D12WindowRenderLoop.h>
#include <Host/HostRuntimeState.h>
#include <Host/InputModifierTracker.h>
#include <Host/NativeRenderer.h>
@@ -23,6 +25,10 @@
#include <string_view>
#include <vector>
namespace XCEngine::UI::Editor::Host {
class WindowMessageDispatcher;
}
namespace XCEngine::UI::Editor {
class Application {
@@ -32,11 +38,15 @@ public:
int Run(HINSTANCE hInstance, int nCmdShow);
private:
friend class ::XCEngine::UI::Editor::Host::WindowMessageDispatcher;
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
bool Initialize(HINSTANCE hInstance, int nCmdShow);
void Shutdown();
void RenderFrame();
void OnDeferredRenderMessage();
void OnPaintMessage();
void OnResize();
void OnEnterSizeMove();
void OnExitSizeMove();
@@ -44,7 +54,6 @@ private:
void QueueWindowResize(UINT width, UINT height);
void QueueCurrentClientResize();
bool ApplyPendingWindowResize();
void RequestDeferredRenderFrame();
bool QueryCurrentClientPixelSize(UINT& outWidth, UINT& outHeight) const;
bool IsPointerInsideClientArea() const;
bool ApplyCurrentCursor() const;
@@ -78,19 +87,14 @@ private:
ATOM m_windowClassAtom = 0;
::XCEngine::UI::Editor::Host::NativeRenderer m_renderer = {};
::XCEngine::UI::Editor::Host::D3D12WindowRenderer m_windowRenderer = {};
::XCEngine::UI::Editor::Host::D3D12WindowRenderLoop m_windowRenderLoop = {};
::XCEngine::UI::Editor::Host::AutoScreenshotController m_autoScreenshot = {};
::XCEngine::UI::Editor::Host::InputModifierTracker m_inputModifierTracker = {};
App::ProductEditorContext m_editorContext = {};
App::ProductEditorWorkspace m_editorWorkspace = {};
std::vector<::XCEngine::UI::UIInputEvent> m_pendingInputEvents = {};
bool m_trackingMouseLeave = false;
UINT m_windowDpi = 96u;
float m_dpiScale = 1.0f;
bool m_inInteractiveResize = false;
bool m_renderFrameQueued = false;
bool m_hasPendingWindowResize = false;
UINT m_pendingWindowResizeWidth = 0u;
UINT m_pendingWindowResizeHeight = 0u;
::XCEngine::UI::Editor::Host::HostRuntimeState m_hostRuntime = {};
};
int RunXCUIEditorApp(HINSTANCE hInstance, int nCmdShow);