添加bgm

This commit is contained in:
2026-04-26 11:39:50 +08:00
parent e80dd15ebf
commit 295dba8bd7
6 changed files with 295 additions and 0 deletions
+50
View File
@@ -302,6 +302,52 @@ void TDrawScreen(HDC hdc, HWND hWnd)
DeleteObject(localAccentPen);
};
auto DrawMusicButton = [&]()
{
RECT musicButtonRect =
{
SX(WINDOW_CLIENT_WIDTH - 40),
SY(WINDOW_CLIENT_HEIGHT - 40),
SX(WINDOW_CLIENT_WIDTH - 12),
SY(WINDOW_CLIENT_HEIGHT - 12)
};
DrawPanelCardAlpha(
musicButtonRect,
bgmEnabled ? RGB(255, 238, 246) : RGB(244, 236, 240),
bgmEnabled ? RGB(222, 130, 166) : RGB(170, 148, 158),
12,
bgmEnabled ? 218 : 190);
HPEN musicPen = CreatePen(PS_SOLID, SS(3), bgmEnabled ? RGB(128, 70, 100) : RGB(128, 112, 120));
HPEN oldMusicPen = (HPEN)SelectObject(hdc, musicPen);
HBRUSH oldMusicBrush = (HBRUSH)SelectObject(hdc, GetStockObject(NULL_BRUSH));
int noteStemX = musicButtonRect.left + SS(17);
int noteTop = musicButtonRect.top + SS(7);
int noteBottom = musicButtonRect.bottom - SS(9);
MoveToEx(hdc, noteStemX, noteTop, nullptr);
LineTo(hdc, noteStemX, noteBottom);
MoveToEx(hdc, noteStemX, noteTop, nullptr);
LineTo(hdc, musicButtonRect.right - SS(7), noteTop + SS(4));
LineTo(hdc, musicButtonRect.right - SS(7), noteTop + SS(10));
Ellipse(
hdc,
musicButtonRect.left + SS(7),
musicButtonRect.bottom - SS(13),
musicButtonRect.left + SS(19),
musicButtonRect.bottom - SS(4));
if (!bgmEnabled)
{
MoveToEx(hdc, musicButtonRect.left + SS(7), musicButtonRect.bottom - SS(7), nullptr);
LineTo(hdc, musicButtonRect.right - SS(6), musicButtonRect.top + SS(6));
}
SelectObject(hdc, oldMusicBrush);
SelectObject(hdc, oldMusicPen);
DeleteObject(musicPen);
};
if (currentScreen == SCREEN_MENU)
{
RECT menuCard =
@@ -418,6 +464,7 @@ void TDrawScreen(HDC hdc, HWND hWnd)
SetTextColor(hdc, RGB(128, 104, 118));
DrawText(hdc, _T("\u65b9\u5411\u952e / WASD \u5207\u6362\uff0cEnter \u6216 Space \u786e\u8ba4\uff0cEsc \u9000\u51fa"), -1, &hintRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
DrawMusicButton();
SelectObject(hdc, oldFont);
DeleteObject(titleFont);
DeleteObject(sectionFont);
@@ -557,6 +604,7 @@ void TDrawScreen(HDC hdc, HWND hWnd)
};
DrawText(hdc, _T("Esc / Backspace / M \u8fd4\u56de\u4e3b\u83dc\u5355"), -1, &backHintRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
DrawMusicButton();
SelectObject(hdc, oldFont);
DeleteObject(titleFont);
DeleteObject(sectionFont);
@@ -1765,6 +1813,8 @@ void TDrawScreen(HDC hdc, HWND hWnd)
DrawText(hdc, _T("W/A/S/D \u6216\u65b9\u5411\u952e\u5207\u6362\uff0cEnter \u6216 Space \u786e\u8ba4"), -1, &hintRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
DrawMusicButton();
SelectObject(hdc, oldFont);
DeleteObject(titleFont);
DeleteObject(sectionFont);