#pragma once #ifndef NOMINMAX #define NOMINMAX #endif #include "Platform/Win32/EditorWindowContentController.h" #include "Platform/Win32/EditorWindowScreenshotController.h" #include #include #include #include #include #include #include #include #include #include #include namespace XCEngine::UI::Editor::App { class EditorContext; class EditorWindowRuntimeController final { public: explicit EditorWindowRuntimeController( std::unique_ptr contentController); ~EditorWindowRuntimeController(); EditorWindowRuntimeController(const EditorWindowRuntimeController&) = delete; EditorWindowRuntimeController& operator=(const EditorWindowRuntimeController&) = delete; EditorWindowRuntimeController(EditorWindowRuntimeController&&) = delete; EditorWindowRuntimeController& operator=(EditorWindowRuntimeController&&) = delete; bool IsReady() const; const UIEditorWorkspaceController* TryGetWorkspaceController() const; UIEditorWorkspaceController* TryGetMutableWorkspaceController(); const UIEditorWorkspaceController& GetWorkspaceController() const; UIEditorWorkspaceController& GetMutableWorkspaceController(); void ReplaceWorkspaceController(UIEditorWorkspaceController workspaceController); const UIEditorShellInteractionFrame& GetShellFrame() const; const UIEditorShellInteractionState& GetShellInteractionState() const; void SetExternalDockHostDropPreview( const Widgets::UIEditorDockHostDropPreviewState& preview); void ClearExternalDockHostDropPreview(); bool TryResolveDockTabDragHotspot( std::string_view nodeId, std::string_view panelId, const ::XCEngine::UI::UIPoint& point, ::XCEngine::UI::UIPoint& outHotspot) const; UIEditorDockHostTabDropTarget ResolveDockTabDropTarget( const ::XCEngine::UI::UIPoint& point) const; bool HasHostedContentCapture() const; bool HasShellInteractiveCapture() const; bool HasInteractiveCapture() const; EditorWindowContentCursorKind GetHostedContentCursorKind() const; EditorWindowContentCursorKind GetDockCursorKind() const; ::XCEngine::UI::UISize ResolveMinimumOuterSize() const; bool ShouldUseDetachedTitleBarTabStrip() const; std::string ResolveTabStripTitleText(std::string_view fallbackTitle) const; std::string ResolveDetachedWindowTitleText( std::string_view fallbackWindowTitle) const; void SetDpiScale(float dpiScale); ::XCEngine::UI::Editor::UIEditorTextMeasurer& GetTextMeasurer(); const ::XCEngine::UI::Editor::UIEditorTextMeasurer& GetTextMeasurer() const; const ::XCEngine::UI::UITextureHandle& GetTitleBarLogoIcon() const; bool Initialize( HWND hwnd, const std::filesystem::path& repoRoot, EditorContext& editorContext, const std::filesystem::path& captureRoot, bool autoCaptureOnStartup); void Shutdown(); void ResetInteractionState(); bool ApplyResize(UINT width, UINT height); Host::D3D12WindowRenderLoopFrameContext BeginFrame(); Host::D3D12WindowRenderLoopPresentResult Present( const ::XCEngine::UI::UIDrawData& drawData); EditorWindowFrameTransferRequests UpdateAndAppend( const EditorWindowContentFrameContext& context, ::XCEngine::UI::UIDrawData& drawData); void RenderRequestedViewports( const ::XCEngine::Rendering::RenderContext& renderContext); void RequestManualScreenshot(std::string reason); std::string BuildCaptureStatusText() const; std::string BuildFrameRateText() const; private: void ResetFrameTiming(); void UpdateFrameTiming(); void RefreshDisplayedFrameStats(); Host::D3D12WindowRenderer m_windowRenderer = {}; Host::D3D12UiTextureHost m_textureHost = {}; Host::D3D12UiTextSystem m_textSystem = {}; Host::D3D12UiRenderer m_uiRenderer = {}; Host::D3D12WindowRenderLoop m_windowRenderLoop = {}; EditorWindowScreenshotController m_screenshotController = {}; ::XCEngine::UI::UITextureHandle m_titleBarLogoIcon = {}; std::unique_ptr m_contentController = {}; std::chrono::steady_clock::time_point m_lastFrameTime = {}; bool m_hasLastFrameTime = false; float m_smoothedDeltaTimeSeconds = 0.0f; float m_frameStatsDisplayAccumulatorSeconds = 0.0f; float m_displayFps = 0.0f; float m_displayFrameTimeMs = 0.0f; float m_dpiScale = 1.0f; std::string m_frameRateText = {}; bool m_ready = false; }; } // namespace XCEngine::UI::Editor::App