#pragma once #ifndef NOMINMAX #define NOMINMAX #endif #include #include #include #include #include #include #include "Core/ProductEditorContext.h" #include "Workspace/ProductEditorWorkspace.h" #include #include #include #include #include #include #include #include namespace XCEngine::UI::Editor::Host { class WindowMessageDispatcher; } namespace XCEngine::UI::Editor { class Application { public: Application() = default; 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 OnPaintMessage(); void OnResize(UINT width, UINT height); void OnEnterSizeMove(); void OnExitSizeMove(); void OnDpiChanged(UINT dpi, const RECT& suggestedRect); bool ApplyWindowResize(UINT width, UINT height); bool QueryCurrentClientPixelSize(UINT& outWidth, UINT& outHeight) const; bool IsPointerInsideClientArea() const; bool ApplyCurrentCursor() const; LPCWSTR ResolveCurrentCursorResource() const; float GetDpiScale() const; float PixelsToDips(float pixels) const; ::XCEngine::UI::UIPoint ConvertClientPixelsToDips(LONG x, LONG y) const; std::string BuildCaptureStatusText() const; void LogRuntimeTrace(std::string_view channel, std::string_view message) const; void ApplyHostCaptureRequests(const UIEditorShellInteractionResult& result); void ApplyHostedContentCaptureRequests(); bool HasInteractiveCaptureState() const; std::string DescribeInputEvents( const std::vector<::XCEngine::UI::UIInputEvent>& events) const; void QueuePointerEvent( ::XCEngine::UI::UIInputEventType type, ::XCEngine::UI::UIPointerButton button, WPARAM wParam, LPARAM lParam); void QueuePointerLeaveEvent(); void QueuePointerWheelEvent(short wheelDelta, WPARAM wParam, LPARAM lParam); void QueueKeyEvent(::XCEngine::UI::UIInputEventType type, WPARAM wParam, LPARAM lParam); void QueueCharacterEvent(WPARAM wParam, LPARAM lParam); void QueueWindowFocusEvent(::XCEngine::UI::UIInputEventType type); static std::filesystem::path ResolveRepoRootPath(); static LONG WINAPI HandleUnhandledException(EXCEPTION_POINTERS* exceptionInfo); static bool IsVerboseRuntimeTraceEnabled(); HWND m_hwnd = nullptr; HINSTANCE m_hInstance = nullptr; 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; bool m_renderReady = false; ::XCEngine::UI::Editor::Host::HostRuntimeState m_hostRuntime = {}; }; int RunXCUIEditorApp(HINSTANCE hInstance, int nCmdShow); } // namespace XCEngine::UI::Editor