完善运行链路 调整中文界面

This commit is contained in:
2026-04-24 10:18:43 +08:00
parent 5f7d7d9949
commit 2f477272ab
3 changed files with 161 additions and 14 deletions
+20 -8
View File
@@ -160,13 +160,13 @@ void TDrawScreen(HDC hdc, HWND hWnd)
gameRect.bottom
};
DrawText(hdc, _T("Tetris"), -1, &infoRect, DT_TOP | DT_LEFT | DT_SINGLELINE);
DrawText(hdc, _T("俄罗斯方块"), -1, &infoRect, DT_TOP | DT_LEFT | DT_SINGLELINE);
TCHAR scoreText[64];
_stprintf_s(scoreText, _T("Score: %d"), tScore);
_stprintf_s(scoreText, _T("当前得分:%d"), tScore);
TextOut(hdc, infoRect.left, infoRect.top + GRID * 2, scoreText, lstrlen(scoreText));
TextOut(hdc, infoRect.left, infoRect.top + GRID * 4, _T("Next:"), 5);
TextOut(hdc, infoRect.left, infoRect.top + GRID * 4, _T("下一个方块:"), lstrlen(_T("下一个方块:")));
RECT nextRect =
{
@@ -210,19 +210,31 @@ void TDrawScreen(HDC hdc, HWND hWnd)
}
}
TextOut(hdc, infoRect.left, infoRect.top + GRID * 11, _T("Controls:"), 9);
TextOut(hdc, infoRect.left, infoRect.top + GRID * 12, _T("Arrow Keys"), 10);
TextOut(hdc, infoRect.left, infoRect.top + GRID * 13, _T("Space: Drop"), 11);
TextOut(hdc, infoRect.left, infoRect.top + GRID * 11, _T("操作说明:"), lstrlen(_T("操作说明:")));
TextOut(hdc, infoRect.left, infoRect.top + GRID * 12, _T("方向键:移动 / 旋转"), lstrlen(_T("方向键:移动 / 旋转")));
TextOut(hdc, infoRect.left, infoRect.top + GRID * 13, _T("空格:快速下落"), lstrlen(_T("空格:快速下落")));
TextOut(hdc, infoRect.left, infoRect.top + GRID * 14, _T("P:暂停 R:重开"), lstrlen(_T("P:暂停 R:重开")));
TextOut(hdc, infoRect.left, infoRect.top + GRID * 15, _T("G:显示/隐藏落点"), lstrlen(_T("G:显示/隐藏落点")));
if (suspendFlag)
{
TextOut(hdc, infoRect.left, infoRect.top + GRID * 15, _T("Paused"), 6);
SetTextColor(hdc, RGB(220, 120, 0));
TextOut(hdc, infoRect.left, infoRect.top + GRID * 17, _T("游戏已暂停"), lstrlen(_T("游戏已暂停")));
SetTextColor(hdc, RGB(40, 40, 40));
}
if (gameOverFlag)
{
RECT overRect = gameRect;
SetTextColor(hdc, RGB(255, 80, 80));
DrawText(hdc, _T("GAME OVER"), -1, &overRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
DrawText(hdc, _T("游戏结束"), -1, &overRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
RECT tipRect =
{
gameRect.left,
gameRect.top + GRID * 11,
gameRect.right,
gameRect.top + GRID * 13
};
DrawText(hdc, _T("按 R 键重新开始"), -1, &tipRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
}