106 lines
3.3 KiB
C
106 lines
3.3 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#ifndef NOMINMAX
|
||
|
|
#define NOMINMAX
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#include "Composition/EditorShellRuntime.h"
|
||
|
|
|
||
|
|
#include <Rendering/D3D12/D3D12WindowRenderLoop.h>
|
||
|
|
#include <Rendering/D3D12/D3D12WindowRenderer.h>
|
||
|
|
#include <Rendering/Native/AutoScreenshot.h>
|
||
|
|
#include <Rendering/Native/NativeRenderer.h>
|
||
|
|
|
||
|
|
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
|
||
|
|
|
||
|
|
#include <XCEngine/UI/DrawData.h>
|
||
|
|
#include <XCEngine/UI/Types.h>
|
||
|
|
|
||
|
|
#include <windows.h>
|
||
|
|
|
||
|
|
#include <filesystem>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
namespace XCEngine::UI::Editor {
|
||
|
|
|
||
|
|
struct UIEditorShellInteractionFrame;
|
||
|
|
struct UIEditorShellInteractionState;
|
||
|
|
|
||
|
|
namespace Widgets {
|
||
|
|
struct UIEditorDockHostDropPreviewState;
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace XCEngine::UI::Editor
|
||
|
|
|
||
|
|
namespace XCEngine::UI::Editor::App {
|
||
|
|
|
||
|
|
class EditorContext;
|
||
|
|
|
||
|
|
namespace Internal {
|
||
|
|
|
||
|
|
class EditorWindowRuntimeController final {
|
||
|
|
public:
|
||
|
|
explicit EditorWindowRuntimeController(UIEditorWorkspaceController workspaceController);
|
||
|
|
~EditorWindowRuntimeController();
|
||
|
|
|
||
|
|
EditorWindowRuntimeController(const EditorWindowRuntimeController&) = delete;
|
||
|
|
EditorWindowRuntimeController& operator=(const EditorWindowRuntimeController&) = delete;
|
||
|
|
EditorWindowRuntimeController(EditorWindowRuntimeController&&) = delete;
|
||
|
|
EditorWindowRuntimeController& operator=(EditorWindowRuntimeController&&) = delete;
|
||
|
|
|
||
|
|
bool IsReady() const;
|
||
|
|
|
||
|
|
const UIEditorWorkspaceController& GetWorkspaceController() const;
|
||
|
|
UIEditorWorkspaceController& GetMutableWorkspaceController();
|
||
|
|
void ReplaceWorkspaceController(UIEditorWorkspaceController workspaceController);
|
||
|
|
|
||
|
|
const EditorShellRuntime& GetShellRuntime() const;
|
||
|
|
EditorShellRuntime& GetShellRuntime();
|
||
|
|
const UIEditorShellInteractionFrame& GetShellFrame() const;
|
||
|
|
const UIEditorShellInteractionState& GetShellInteractionState() const;
|
||
|
|
|
||
|
|
void SetExternalDockHostDropPreview(
|
||
|
|
const Widgets::UIEditorDockHostDropPreviewState& preview);
|
||
|
|
void ClearExternalDockHostDropPreview();
|
||
|
|
|
||
|
|
void SetDpiScale(float dpiScale);
|
||
|
|
Host::NativeRenderer& GetRenderer();
|
||
|
|
const Host::NativeRenderer& GetRenderer() 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() const;
|
||
|
|
Host::D3D12WindowRenderLoopPresentResult Present(
|
||
|
|
const ::XCEngine::UI::UIDrawData& drawData) const;
|
||
|
|
void CaptureIfRequested(
|
||
|
|
const ::XCEngine::UI::UIDrawData& drawData,
|
||
|
|
UINT pixelWidth,
|
||
|
|
UINT pixelHeight,
|
||
|
|
bool framePresented);
|
||
|
|
|
||
|
|
void RequestManualScreenshot(std::string reason);
|
||
|
|
std::string BuildCaptureStatusText() const;
|
||
|
|
|
||
|
|
private:
|
||
|
|
Host::NativeRenderer m_renderer = {};
|
||
|
|
Host::D3D12WindowRenderer m_windowRenderer = {};
|
||
|
|
Host::D3D12WindowRenderLoop m_windowRenderLoop = {};
|
||
|
|
Host::AutoScreenshotController m_autoScreenshot = {};
|
||
|
|
::XCEngine::UI::UITextureHandle m_titleBarLogoIcon = {};
|
||
|
|
UIEditorWorkspaceController m_workspaceController = {};
|
||
|
|
EditorShellRuntime m_shellRuntime = {};
|
||
|
|
bool m_ready = false;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace Internal
|
||
|
|
} // namespace XCEngine::UI::Editor::App
|