添加鼠标点击功能

This commit is contained in:
2026-04-26 16:02:52 +08:00
parent a117b12981
commit 7db0bfadfc
3 changed files with 507 additions and 37 deletions
+113 -14
View File
@@ -374,6 +374,33 @@ void TDrawScreen(HDC hdc, HWND hWnd)
DeleteObject(musicPen);
};
auto DrawBackButton = [&]()
{
RECT backButtonRect =
{
SX(6),
SY(6),
SX(34),
SY(34)
};
DrawPanelCardAlpha(
backButtonRect,
RGB(255, 242, 247),
RGB(222, 130, 166),
12,
214);
HPEN backPen = CreatePen(PS_SOLID, SS(3), RGB(128, 70, 100));
HPEN oldBackPen = (HPEN)SelectObject(hdc, backPen);
MoveToEx(hdc, backButtonRect.left + SS(20), backButtonRect.top + SS(8), nullptr);
LineTo(hdc, backButtonRect.left + SS(10), backButtonRect.top + SS(14));
LineTo(hdc, backButtonRect.left + SS(20), backButtonRect.top + SS(20));
MoveToEx(hdc, backButtonRect.left + SS(10), backButtonRect.top + SS(14), nullptr);
LineTo(hdc, backButtonRect.right - SS(8), backButtonRect.top + SS(14));
SelectObject(hdc, oldBackPen);
DeleteObject(backPen);
};
if (currentScreen == SCREEN_MENU)
{
RECT menuCard =
@@ -746,6 +773,7 @@ void TDrawScreen(HDC hdc, HWND hWnd)
: _T("Esc / Backspace / M \u8fd4\u56de\u5e2e\u52a9");
DrawText(hdc, helpHint, -1, &backHintRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
DrawBackButton();
DrawMusicButton();
SelectObject(hdc, oldFont);
DeleteObject(titleFont);
@@ -1767,10 +1795,10 @@ void TDrawScreen(HDC hdc, HWND hWnd)
{
RECT overlayRect =
{
gameRect.left + SS(48),
gameRect.top + grid * 7,
gameRect.right - SS(48),
gameRect.top + grid * 11 + SS(18)
gameRect.left + SS(28),
gameRect.top + grid * 6 + SS(10),
gameRect.right - SS(28),
gameRect.top + grid * 10 + SS(30)
};
HBRUSH overlayBrush = CreateSolidBrush(RGB(255, 241, 246));
@@ -1805,21 +1833,88 @@ void TDrawScreen(HDC hdc, HWND hWnd)
if (suspendFlag)
{
DrawText(hdc, _T("时间静止"), -1, &titleRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
int buttonGap = SS(18);
int buttonWidth = (overlayRect.right - overlayRect.left - SS(68) - buttonGap) / 2;
RECT continueRect =
{
overlayRect.left + SS(34),
overlayRect.top + SS(94),
overlayRect.left + SS(34) + buttonWidth,
overlayRect.top + SS(138)
};
RECT menuRect =
{
continueRect.right + buttonGap,
continueRect.top,
overlayRect.right - SS(34),
continueRect.bottom
};
DrawPanelCardAlpha(continueRect, RGB(255, 232, 240), RGB(222, 130, 166), 18, 224);
DrawPanelCardAlpha(menuRect, RGB(255, 247, 250), RGB(210, 182, 194), 18, 210);
SelectObject(hdc, bodyFont);
DrawText(hdc, _T("按 P 继续战斗"), -1, &tipRect, DT_CENTER | DT_VCENTER | DT_WORDBREAK);
DrawText(hdc, _T("继续 (P)"), -1, &continueRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
DrawText(hdc, _T("主菜单 (M)"), -1, &menuRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
else
{
DrawText(hdc, _T("战局崩塌"), -1, &titleRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
SelectObject(hdc, bodyFont);
DrawText(
hdc,
reviveAvailable
? _T("按 V 看视频复活(仅一次)\r\n按 R 重新挑战 或按 M 返回菜单")
: _T("按 R 重新挑战\r\n或按 M 返回菜单"),
-1,
&tipRect,
DT_CENTER | DT_VCENTER | DT_WORDBREAK);
if (reviveAvailable)
{
int buttonGap = SS(8);
int buttonWidth = (overlayRect.right - overlayRect.left - SS(28) - buttonGap * 2) / 3;
RECT reviveRect =
{
overlayRect.left + SS(14),
overlayRect.top + SS(94),
overlayRect.left + SS(14) + buttonWidth,
overlayRect.top + SS(138)
};
RECT restartRect =
{
reviveRect.right + buttonGap,
reviveRect.top,
reviveRect.right + buttonGap + buttonWidth,
reviveRect.bottom
};
RECT menuRect =
{
restartRect.right + buttonGap,
reviveRect.top,
overlayRect.right - SS(14),
reviveRect.bottom
};
DrawPanelCardAlpha(reviveRect, RGB(255, 232, 240), RGB(222, 130, 166), 18, 224);
DrawPanelCardAlpha(restartRect, RGB(255, 247, 250), RGB(210, 182, 194), 18, 210);
DrawPanelCardAlpha(menuRect, RGB(255, 247, 250), RGB(210, 182, 194), 18, 210);
SelectObject(hdc, bodyFont);
DrawText(hdc, _T("复活 (V)"), -1, &reviveRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
DrawText(hdc, _T("重开 (R)"), -1, &restartRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
DrawText(hdc, _T("主菜单 (M)"), -1, &menuRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
else
{
int buttonGap = SS(18);
int buttonWidth = (overlayRect.right - overlayRect.left - SS(68) - buttonGap) / 2;
RECT restartRect =
{
overlayRect.left + SS(34),
overlayRect.top + SS(94),
overlayRect.left + SS(34) + buttonWidth,
overlayRect.top + SS(138)
};
RECT menuRect =
{
restartRect.right + buttonGap,
restartRect.top,
overlayRect.right - SS(34),
restartRect.bottom
};
DrawPanelCardAlpha(restartRect, RGB(255, 232, 240), RGB(222, 130, 166), 18, 224);
DrawPanelCardAlpha(menuRect, RGB(255, 247, 250), RGB(210, 182, 194), 18, 210);
SelectObject(hdc, bodyFont);
DrawText(hdc, _T("重开 (R)"), -1, &restartRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
DrawText(hdc, _T("主菜单 (M)"), -1, &menuRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
}
}
@@ -2075,6 +2170,10 @@ void TDrawScreen(HDC hdc, HWND hWnd)
DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
if (currentScreen != SCREEN_MENU)
{
DrawBackButton();
}
DrawMusicButton();
SelectObject(hdc, oldFont);