Stabilize XCEditor shell foundation widgets
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
add_executable(editor_ui_panel_frame_basic_validation WIN32
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_include_directories(editor_ui_panel_frame_basic_validation PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/new_editor/include
|
||||
${CMAKE_SOURCE_DIR}/new_editor/app
|
||||
${CMAKE_SOURCE_DIR}/engine/include
|
||||
)
|
||||
|
||||
target_compile_definitions(editor_ui_panel_frame_basic_validation PRIVATE
|
||||
UNICODE
|
||||
_UNICODE
|
||||
XCENGINE_EDITOR_UI_TESTS_REPO_ROOT="${XCENGINE_EDITOR_UI_TESTS_REPO_ROOT_PATH}"
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(editor_ui_panel_frame_basic_validation PRIVATE /utf-8 /FS)
|
||||
set_property(TARGET editor_ui_panel_frame_basic_validation PROPERTY
|
||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
endif()
|
||||
|
||||
target_link_libraries(editor_ui_panel_frame_basic_validation PRIVATE
|
||||
XCUIEditorLib
|
||||
XCUIEditorHost
|
||||
)
|
||||
|
||||
set_target_properties(editor_ui_panel_frame_basic_validation PROPERTIES
|
||||
OUTPUT_NAME "XCUIEditorPanelFrameBasicValidation"
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
520
tests/UI/Editor/integration/shell/panel_frame_basic/main.cpp
Normal file
520
tests/UI/Editor/integration/shell/panel_frame_basic/main.cpp
Normal file
@@ -0,0 +1,520 @@
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <XCEditor/Widgets/UIEditorPanelFrame.h>
|
||||
#include "Host/AutoScreenshot.h"
|
||||
#include "Host/NativeRenderer.h"
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#ifndef XCENGINE_EDITOR_UI_TESTS_REPO_ROOT
|
||||
#define XCENGINE_EDITOR_UI_TESTS_REPO_ROOT "."
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
using XCEngine::UI::UIColor;
|
||||
using XCEngine::UI::UIDrawData;
|
||||
using XCEngine::UI::UIDrawList;
|
||||
using XCEngine::UI::UIPoint;
|
||||
using XCEngine::UI::UIRect;
|
||||
using XCEngine::UI::Editor::Host::AutoScreenshotController;
|
||||
using XCEngine::UI::Editor::Host::NativeRenderer;
|
||||
using XCEngine::UI::Editor::Widgets::AppendUIEditorPanelFrameBackground;
|
||||
using XCEngine::UI::Editor::Widgets::AppendUIEditorPanelFrameForeground;
|
||||
using XCEngine::UI::Editor::Widgets::BuildUIEditorPanelFrameLayout;
|
||||
using XCEngine::UI::Editor::Widgets::HitTestUIEditorPanelFrame;
|
||||
using XCEngine::UI::Editor::Widgets::UIEditorPanelFrameHitTarget;
|
||||
using XCEngine::UI::Editor::Widgets::UIEditorPanelFrameLayout;
|
||||
using XCEngine::UI::Editor::Widgets::UIEditorPanelFrameState;
|
||||
using XCEngine::UI::Editor::Widgets::UIEditorPanelFrameText;
|
||||
|
||||
constexpr const wchar_t* kWindowClassName = L"XCUIEditorPanelFrameBasicValidation";
|
||||
constexpr const wchar_t* kWindowTitle = L"XCUI Editor | PanelFrame Basic";
|
||||
|
||||
constexpr UIColor kWindowBg(0.13f, 0.13f, 0.13f, 1.0f);
|
||||
constexpr UIColor kCardBg(0.18f, 0.18f, 0.18f, 1.0f);
|
||||
constexpr UIColor kCardBorder(0.30f, 0.30f, 0.30f, 1.0f);
|
||||
constexpr UIColor kCardAccent(0.82f, 0.82f, 0.82f, 1.0f);
|
||||
constexpr UIColor kTextPrimary(0.94f, 0.94f, 0.94f, 1.0f);
|
||||
constexpr UIColor kTextMuted(0.72f, 0.72f, 0.72f, 1.0f);
|
||||
constexpr UIColor kTextWeak(0.56f, 0.56f, 0.56f, 1.0f);
|
||||
constexpr UIColor kButtonBg(0.26f, 0.26f, 0.26f, 1.0f);
|
||||
constexpr UIColor kButtonOnBg(0.42f, 0.42f, 0.42f, 1.0f);
|
||||
constexpr UIColor kButtonBorder(0.48f, 0.48f, 0.48f, 1.0f);
|
||||
|
||||
enum class ActionId : unsigned char {
|
||||
ToggleFooter = 0,
|
||||
TogglePin,
|
||||
ToggleClose,
|
||||
Reset
|
||||
};
|
||||
|
||||
struct ButtonState {
|
||||
ActionId action = ActionId::ToggleFooter;
|
||||
std::string label = {};
|
||||
UIRect rect = {};
|
||||
bool selected = false;
|
||||
};
|
||||
|
||||
std::filesystem::path ResolveRepoRootPath() {
|
||||
std::string root = XCENGINE_EDITOR_UI_TESTS_REPO_ROOT;
|
||||
if (root.size() >= 2u && root.front() == '"' && root.back() == '"') {
|
||||
root = root.substr(1u, root.size() - 2u);
|
||||
}
|
||||
|
||||
return std::filesystem::path(root).lexically_normal();
|
||||
}
|
||||
|
||||
bool ContainsPoint(const UIRect& rect, float x, float y) {
|
||||
return x >= rect.x &&
|
||||
x <= rect.x + rect.width &&
|
||||
y >= rect.y &&
|
||||
y <= rect.y + rect.height;
|
||||
}
|
||||
|
||||
std::string DescribePart(UIEditorPanelFrameHitTarget part) {
|
||||
switch (part) {
|
||||
case UIEditorPanelFrameHitTarget::Header: return "Header";
|
||||
case UIEditorPanelFrameHitTarget::Body: return "Body";
|
||||
case UIEditorPanelFrameHitTarget::Footer: return "Footer";
|
||||
case UIEditorPanelFrameHitTarget::PinButton: return "Pin";
|
||||
case UIEditorPanelFrameHitTarget::CloseButton: return "Close";
|
||||
default: return "None";
|
||||
}
|
||||
}
|
||||
|
||||
void DrawCard(
|
||||
UIDrawList& drawList,
|
||||
const UIRect& rect,
|
||||
std::string_view title,
|
||||
std::string_view subtitle = {}) {
|
||||
drawList.AddFilledRect(rect, kCardBg, 10.0f);
|
||||
drawList.AddRectOutline(rect, kCardBorder, 1.0f, 10.0f);
|
||||
drawList.AddText(UIPoint(rect.x + 16.0f, rect.y + 14.0f), std::string(title), kTextPrimary, 17.0f);
|
||||
if (!subtitle.empty()) {
|
||||
drawList.AddText(UIPoint(rect.x + 16.0f, rect.y + 38.0f), std::string(subtitle), kTextMuted, 12.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawButton(
|
||||
UIDrawList& drawList,
|
||||
const ButtonState& button) {
|
||||
drawList.AddFilledRect(button.rect, button.selected ? kButtonOnBg : kButtonBg, 8.0f);
|
||||
drawList.AddRectOutline(button.rect, button.selected ? kCardAccent : kButtonBorder, 1.0f, 8.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(button.rect.x + 12.0f, button.rect.y + 10.0f),
|
||||
button.label,
|
||||
kTextPrimary,
|
||||
12.0f);
|
||||
}
|
||||
|
||||
class ScenarioApp {
|
||||
public:
|
||||
int Run(HINSTANCE hInstance, int nCmdShow) {
|
||||
if (!Initialize(hInstance, nCmdShow)) {
|
||||
Shutdown();
|
||||
return 1;
|
||||
}
|
||||
|
||||
MSG message = {};
|
||||
while (message.message != WM_QUIT) {
|
||||
if (PeekMessageW(&message, nullptr, 0U, 0U, PM_REMOVE)) {
|
||||
TranslateMessage(&message);
|
||||
DispatchMessageW(&message);
|
||||
continue;
|
||||
}
|
||||
|
||||
RenderFrame();
|
||||
Sleep(8);
|
||||
}
|
||||
|
||||
Shutdown();
|
||||
return static_cast<int>(message.wParam);
|
||||
}
|
||||
|
||||
private:
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
if (message == WM_NCCREATE) {
|
||||
const auto* createStruct = reinterpret_cast<CREATESTRUCTW*>(lParam);
|
||||
auto* app = reinterpret_cast<ScenarioApp*>(createStruct->lpCreateParams);
|
||||
SetWindowLongPtrW(hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(app));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
auto* app = reinterpret_cast<ScenarioApp*>(GetWindowLongPtrW(hwnd, GWLP_USERDATA));
|
||||
switch (message) {
|
||||
case WM_SIZE:
|
||||
if (app != nullptr && wParam != SIZE_MINIMIZED) {
|
||||
app->OnResize(static_cast<UINT>(LOWORD(lParam)), static_cast<UINT>(HIWORD(lParam)));
|
||||
}
|
||||
return 0;
|
||||
case WM_MOUSEMOVE:
|
||||
if (app != nullptr) {
|
||||
app->HandleMouseMove(
|
||||
static_cast<float>(GET_X_LPARAM(lParam)),
|
||||
static_cast<float>(GET_Y_LPARAM(lParam)));
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case WM_MOUSELEAVE:
|
||||
if (app != nullptr) {
|
||||
app->HandleMouseLeave();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
if (app != nullptr) {
|
||||
app->HandleClick(
|
||||
static_cast<float>(GET_X_LPARAM(lParam)),
|
||||
static_cast<float>(GET_Y_LPARAM(lParam)));
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
if (app != nullptr && wParam == VK_F12) {
|
||||
app->m_autoScreenshot.RequestCapture("manual_f12");
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case WM_PAINT:
|
||||
if (app != nullptr) {
|
||||
PAINTSTRUCT paintStruct = {};
|
||||
BeginPaint(hwnd, &paintStruct);
|
||||
app->RenderFrame();
|
||||
EndPaint(hwnd, &paintStruct);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProcW(hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
bool Initialize(HINSTANCE hInstance, int nCmdShow) {
|
||||
m_captureRoot =
|
||||
ResolveRepoRootPath() / "tests/UI/Editor/integration/shell/panel_frame_basic/captures";
|
||||
m_autoScreenshot.Initialize(m_captureRoot);
|
||||
|
||||
WNDCLASSEXW windowClass = {};
|
||||
windowClass.cbSize = sizeof(windowClass);
|
||||
windowClass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
windowClass.lpfnWndProc = &ScenarioApp::WndProc;
|
||||
windowClass.hInstance = hInstance;
|
||||
windowClass.hCursor = LoadCursorW(nullptr, IDC_ARROW);
|
||||
windowClass.lpszClassName = kWindowClassName;
|
||||
|
||||
m_windowClassAtom = RegisterClassExW(&windowClass);
|
||||
if (m_windowClassAtom == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_hwnd = CreateWindowExW(
|
||||
0,
|
||||
kWindowClassName,
|
||||
kWindowTitle,
|
||||
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
1440,
|
||||
920,
|
||||
nullptr,
|
||||
nullptr,
|
||||
hInstance,
|
||||
this);
|
||||
if (m_hwnd == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ShowWindow(m_hwnd, nCmdShow);
|
||||
UpdateWindow(m_hwnd);
|
||||
|
||||
if (!m_renderer.Initialize(m_hwnd)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ResetState();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Shutdown() {
|
||||
m_autoScreenshot.Shutdown();
|
||||
m_renderer.Shutdown();
|
||||
|
||||
if (m_hwnd != nullptr && IsWindow(m_hwnd)) {
|
||||
DestroyWindow(m_hwnd);
|
||||
}
|
||||
m_hwnd = nullptr;
|
||||
|
||||
if (m_windowClassAtom != 0) {
|
||||
UnregisterClassW(kWindowClassName, GetModuleHandleW(nullptr));
|
||||
m_windowClassAtom = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void OnResize(UINT width, UINT height) {
|
||||
m_renderer.Resize(width, height);
|
||||
}
|
||||
|
||||
void HandleMouseMove(float x, float y) {
|
||||
m_mousePosition = UIPoint(x, y);
|
||||
TRACKMOUSEEVENT event = {};
|
||||
event.cbSize = sizeof(event);
|
||||
event.dwFlags = TME_LEAVE;
|
||||
event.hwndTrack = m_hwnd;
|
||||
TrackMouseEvent(&event);
|
||||
UpdateHoveredPart();
|
||||
}
|
||||
|
||||
void HandleMouseLeave() {
|
||||
m_mousePosition = UIPoint(-1000.0f, -1000.0f);
|
||||
m_hoveredPart = UIEditorPanelFrameHitTarget::None;
|
||||
}
|
||||
|
||||
void HandleClick(float x, float y) {
|
||||
for (const ButtonState& button : m_buttons) {
|
||||
if (ContainsPoint(button.rect, x, y)) {
|
||||
ExecuteAction(button.action);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const UIEditorPanelFrameHitTarget part =
|
||||
HitTestUIEditorPanelFrame(m_layout, m_state, UIPoint(x, y));
|
||||
switch (part) {
|
||||
case UIEditorPanelFrameHitTarget::Header:
|
||||
m_state.active = !m_state.active;
|
||||
m_lastResult = m_state.active ? "Header click -> Active = On" : "Header click -> Active = Off";
|
||||
break;
|
||||
case UIEditorPanelFrameHitTarget::Body:
|
||||
case UIEditorPanelFrameHitTarget::Footer:
|
||||
m_state.focused = true;
|
||||
m_lastResult = "Body/Footer click -> Focus = On";
|
||||
break;
|
||||
case UIEditorPanelFrameHitTarget::PinButton:
|
||||
if (m_state.pinnable) {
|
||||
m_state.pinned = !m_state.pinned;
|
||||
m_lastResult = m_state.pinned ? "Pin click -> Pinned = On" : "Pin click -> Pinned = Off";
|
||||
}
|
||||
break;
|
||||
case UIEditorPanelFrameHitTarget::CloseButton:
|
||||
if (m_state.closable) {
|
||||
++m_closeDispatchCount;
|
||||
m_lastResult = "Close click -> CloseRequested #" + std::to_string(m_closeDispatchCount);
|
||||
}
|
||||
break;
|
||||
case UIEditorPanelFrameHitTarget::None:
|
||||
default:
|
||||
m_state.focused = false;
|
||||
m_lastResult = "Outside click -> Focus = Off";
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateHoveredPart();
|
||||
}
|
||||
|
||||
void ExecuteAction(ActionId action) {
|
||||
switch (action) {
|
||||
case ActionId::ToggleFooter:
|
||||
m_state.showFooter = !m_state.showFooter;
|
||||
m_lastResult = m_state.showFooter ? "Footer = On" : "Footer = Off";
|
||||
break;
|
||||
case ActionId::TogglePin:
|
||||
m_state.pinnable = !m_state.pinnable;
|
||||
if (!m_state.pinnable) {
|
||||
m_state.pinned = false;
|
||||
}
|
||||
m_lastResult = m_state.pinnable ? "Pin button = On" : "Pin button = Off";
|
||||
break;
|
||||
case ActionId::ToggleClose:
|
||||
m_state.closable = !m_state.closable;
|
||||
m_lastResult = m_state.closable ? "Close button = On" : "Close button = Off";
|
||||
break;
|
||||
case ActionId::Reset:
|
||||
ResetState();
|
||||
m_lastResult = "State reset";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetState() {
|
||||
m_state = {};
|
||||
m_state.active = true;
|
||||
m_state.showFooter = true;
|
||||
m_state.pinnable = true;
|
||||
m_state.closable = true;
|
||||
m_hoveredPart = UIEditorPanelFrameHitTarget::None;
|
||||
m_lastResult = "Ready";
|
||||
m_closeDispatchCount = 0;
|
||||
}
|
||||
|
||||
void UpdateHoveredPart() {
|
||||
m_hoveredPart = HitTestUIEditorPanelFrame(m_layout, m_state, m_mousePosition);
|
||||
}
|
||||
|
||||
void BuildButtons(float left, float top, float width) {
|
||||
const float buttonHeight = 34.0f;
|
||||
const float gap = 10.0f;
|
||||
m_buttons = {
|
||||
{ ActionId::ToggleFooter, "Footer", UIRect(left, top, width, buttonHeight), m_state.showFooter },
|
||||
{ ActionId::TogglePin, "Pin Button", UIRect(left, top + (buttonHeight + gap), width, buttonHeight), m_state.pinnable },
|
||||
{ ActionId::ToggleClose, "Close Button", UIRect(left, top + (buttonHeight + gap) * 2.0f, width, buttonHeight), m_state.closable },
|
||||
{ ActionId::Reset, "Reset", UIRect(left, top + (buttonHeight + gap) * 3.0f, width, buttonHeight), false }
|
||||
};
|
||||
}
|
||||
|
||||
void RenderFrame() {
|
||||
RECT clientRect = {};
|
||||
GetClientRect(m_hwnd, &clientRect);
|
||||
const float width = static_cast<float>((std::max)(1L, clientRect.right - clientRect.left));
|
||||
const float height = static_cast<float>((std::max)(1L, clientRect.bottom - clientRect.top));
|
||||
|
||||
const float leftColumnWidth = 340.0f;
|
||||
const float outerPadding = 20.0f;
|
||||
const UIRect introRect(outerPadding, outerPadding, leftColumnWidth, 148.0f);
|
||||
const UIRect controlsRect(outerPadding, 188.0f, leftColumnWidth, 180.0f);
|
||||
const UIRect stateRect(outerPadding, 388.0f, leftColumnWidth, 220.0f);
|
||||
const UIRect panelRect(
|
||||
leftColumnWidth + outerPadding * 2.0f,
|
||||
outerPadding,
|
||||
width - leftColumnWidth - outerPadding * 3.0f,
|
||||
height - outerPadding * 2.0f);
|
||||
|
||||
BuildButtons(controlsRect.x + 16.0f, controlsRect.y + 54.0f, controlsRect.width - 32.0f);
|
||||
|
||||
UIDrawData drawData = {};
|
||||
UIDrawList& drawList = drawData.EmplaceDrawList("PanelFrameBasic");
|
||||
drawList.AddFilledRect(UIRect(0.0f, 0.0f, width, height), kWindowBg);
|
||||
|
||||
DrawCard(
|
||||
drawList,
|
||||
introRect,
|
||||
"测试功能:PanelFrame 基础壳层",
|
||||
"重点检查:Header / Body / Footer 布局,Active / Focus 边框,Pin / Close 命中。");
|
||||
drawList.AddText(
|
||||
UIPoint(introRect.x + 16.0f, introRect.y + 66.0f),
|
||||
"操作:移动鼠标观察 hover;点 Header 切 Active;点 Body/Footer 取 Focus;点 Pin/Close 看 Result;按 F12 截图。",
|
||||
kTextMuted,
|
||||
12.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(introRect.x + 16.0f, introRect.y + 90.0f),
|
||||
"这个场景只验证 Editor 基础层 PanelFrame,不包含任何业务面板。",
|
||||
kTextWeak,
|
||||
12.0f);
|
||||
|
||||
DrawCard(drawList, controlsRect, "开关", "这里只保留基础状态开关,避免试验面板过杂。");
|
||||
for (const ButtonState& button : m_buttons) {
|
||||
DrawButton(drawList, button);
|
||||
}
|
||||
|
||||
DrawCard(drawList, stateRect, "状态", "右侧面板的命中结果和状态变化会同步显示在这里。");
|
||||
drawList.AddText(
|
||||
UIPoint(stateRect.x + 16.0f, stateRect.y + 66.0f),
|
||||
"Hover: " + DescribePart(m_hoveredPart),
|
||||
kTextPrimary,
|
||||
13.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(stateRect.x + 16.0f, stateRect.y + 92.0f),
|
||||
std::string("Active: ") + (m_state.active ? "On" : "Off"),
|
||||
kTextPrimary,
|
||||
13.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(stateRect.x + 16.0f, stateRect.y + 118.0f),
|
||||
std::string("Focused: ") + (m_state.focused ? "On" : "Off"),
|
||||
kTextPrimary,
|
||||
13.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(stateRect.x + 16.0f, stateRect.y + 144.0f),
|
||||
std::string("Pinned: ") + (m_state.pinned ? "On" : "Off"),
|
||||
kTextPrimary,
|
||||
13.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(stateRect.x + 16.0f, stateRect.y + 170.0f),
|
||||
"Result: " + m_lastResult,
|
||||
kTextMuted,
|
||||
12.0f);
|
||||
|
||||
UIEditorPanelFrameState frameState = m_state;
|
||||
frameState.hovered = m_hoveredPart != UIEditorPanelFrameHitTarget::None;
|
||||
frameState.pinHovered = m_hoveredPart == UIEditorPanelFrameHitTarget::PinButton;
|
||||
frameState.closeHovered = m_hoveredPart == UIEditorPanelFrameHitTarget::CloseButton;
|
||||
m_layout = BuildUIEditorPanelFrameLayout(panelRect, frameState);
|
||||
|
||||
AppendUIEditorPanelFrameBackground(drawList, m_layout, frameState);
|
||||
AppendUIEditorPanelFrameForeground(
|
||||
drawList,
|
||||
m_layout,
|
||||
frameState,
|
||||
UIEditorPanelFrameText{
|
||||
"Inspector Placeholder",
|
||||
"PanelFrame foundation validation",
|
||||
m_state.showFooter
|
||||
? "Footer visible | Active=" + std::string(m_state.active ? "On" : "Off")
|
||||
: ""
|
||||
});
|
||||
|
||||
drawList.AddText(
|
||||
UIPoint(m_layout.bodyRect.x, m_layout.bodyRect.y),
|
||||
"Body content placeholder",
|
||||
kTextPrimary,
|
||||
15.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(m_layout.bodyRect.x, m_layout.bodyRect.y + 28.0f),
|
||||
"Hover current region: " + DescribePart(m_hoveredPart),
|
||||
kTextMuted,
|
||||
12.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(m_layout.bodyRect.x, m_layout.bodyRect.y + 50.0f),
|
||||
"Pin button and Close button use PanelFrame hit rects.",
|
||||
kTextMuted,
|
||||
12.0f);
|
||||
drawList.AddText(
|
||||
UIPoint(m_layout.bodyRect.x, m_layout.bodyRect.y + 72.0f),
|
||||
"Close does not destroy the panel here. It only verifies dispatch intent.",
|
||||
kTextWeak,
|
||||
12.0f);
|
||||
|
||||
const bool framePresented = m_renderer.Render(drawData);
|
||||
m_autoScreenshot.CaptureIfRequested(
|
||||
m_renderer,
|
||||
drawData,
|
||||
static_cast<unsigned int>(width),
|
||||
static_cast<unsigned int>(height),
|
||||
framePresented);
|
||||
}
|
||||
|
||||
HWND m_hwnd = nullptr;
|
||||
ATOM m_windowClassAtom = 0;
|
||||
NativeRenderer m_renderer = {};
|
||||
AutoScreenshotController m_autoScreenshot = {};
|
||||
std::filesystem::path m_captureRoot = {};
|
||||
std::vector<ButtonState> m_buttons = {};
|
||||
UIPoint m_mousePosition = UIPoint(-1000.0f, -1000.0f);
|
||||
UIEditorPanelFrameState m_state = {};
|
||||
UIEditorPanelFrameLayout m_layout = {};
|
||||
UIEditorPanelFrameHitTarget m_hoveredPart = UIEditorPanelFrameHitTarget::None;
|
||||
std::string m_lastResult = {};
|
||||
int m_closeDispatchCount = 0;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int nCmdShow) {
|
||||
return ScenarioApp().Run(hInstance, nCmdShow);
|
||||
}
|
||||
Reference in New Issue
Block a user