103 lines
3.6 KiB
C++
103 lines
3.6 KiB
C++
#pragma once
|
|
|
|
#ifndef NOMINMAX
|
|
#define NOMINMAX
|
|
#endif
|
|
|
|
#include <Host/AutoScreenshot.h>
|
|
#include <Host/D3D12WindowRenderer.h>
|
|
#include <Host/D3D12WindowRenderLoop.h>
|
|
#include <Host/HostRuntimeState.h>
|
|
#include <Host/InputModifierTracker.h>
|
|
#include <Host/NativeRenderer.h>
|
|
|
|
#include "Core/ProductEditorContext.h"
|
|
#include "Workspace/ProductEditorWorkspace.h"
|
|
|
|
#include <XCEditor/Shell/UIEditorShellInteraction.h>
|
|
|
|
#include <windows.h>
|
|
#include <windowsx.h>
|
|
|
|
#include <cstdint>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
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 OnDeferredRenderMessage();
|
|
void OnPaintMessage();
|
|
void OnResize();
|
|
void OnEnterSizeMove();
|
|
void OnExitSizeMove();
|
|
void OnDpiChanged(UINT dpi, const RECT& suggestedRect);
|
|
void QueueWindowResize(UINT width, UINT height);
|
|
void QueueCurrentClientResize();
|
|
bool ApplyPendingWindowResize();
|
|
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;
|
|
::XCEngine::UI::Editor::Host::HostRuntimeState m_hostRuntime = {};
|
|
};
|
|
|
|
int RunXCUIEditorApp(HINSTANCE hInstance, int nCmdShow);
|
|
|
|
} // namespace XCEngine::UI::Editor
|