移除旧的GameOver判定并统一顶部溢出失败逻辑
This commit is contained in:
+27
-24
@@ -217,7 +217,7 @@ void TDrawScreen(HDC hdc, HWND hWnd)
|
||||
}
|
||||
|
||||
// 绘制预测落点
|
||||
if (targetFlag)
|
||||
if (targetFlag && !gameOverFlag)
|
||||
{
|
||||
HPEN targetPen = CreatePen(PS_DOT, SS(2), RGB(255, 240, 245));
|
||||
oldPen = (HPEN)SelectObject(hdc, targetPen);
|
||||
@@ -252,34 +252,37 @@ void TDrawScreen(HDC hdc, HWND hWnd)
|
||||
}
|
||||
|
||||
// 绘制当前活动方块
|
||||
for (int i = 0; i < 4; i++)
|
||||
if (!gameOverFlag)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (bricks[type][state][i][j] != 0)
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
int drawY = point.y + i;
|
||||
int drawX = point.x + j;
|
||||
|
||||
if (drawY >= 0 && drawY < nGameHeight && drawX >= 0 && drawX < nGameWidth)
|
||||
if (bricks[type][state][i][j] != 0)
|
||||
{
|
||||
RECT brickRect =
|
||||
{
|
||||
gameRect.left + drawX * grid + SS(2),
|
||||
gameRect.top + drawY * grid + SS(2),
|
||||
gameRect.left + (drawX + 1) * grid - SS(2),
|
||||
gameRect.top + (drawY + 1) * grid - SS(2)
|
||||
};
|
||||
int drawY = point.y + i;
|
||||
int drawX = point.x + j;
|
||||
|
||||
HBRUSH brickBrush = CreateSolidBrush(BrickColor[type]);
|
||||
HPEN brickPen = CreatePen(PS_SOLID, 1, RGB(255, 250, 252));
|
||||
oldPen = (HPEN)SelectObject(hdc, brickPen);
|
||||
oldBrush = (HBRUSH)SelectObject(hdc, brickBrush);
|
||||
RoundRect(hdc, brickRect.left, brickRect.top, brickRect.right, brickRect.bottom, SS(12), SS(12));
|
||||
SelectObject(hdc, oldBrush);
|
||||
SelectObject(hdc, oldPen);
|
||||
DeleteObject(brickBrush);
|
||||
DeleteObject(brickPen);
|
||||
if (drawY >= 0 && drawY < nGameHeight && drawX >= 0 && drawX < nGameWidth)
|
||||
{
|
||||
RECT brickRect =
|
||||
{
|
||||
gameRect.left + drawX * grid + SS(2),
|
||||
gameRect.top + drawY * grid + SS(2),
|
||||
gameRect.left + (drawX + 1) * grid - SS(2),
|
||||
gameRect.top + (drawY + 1) * grid - SS(2)
|
||||
};
|
||||
|
||||
HBRUSH brickBrush = CreateSolidBrush(BrickColor[type]);
|
||||
HPEN brickPen = CreatePen(PS_SOLID, 1, RGB(255, 250, 252));
|
||||
oldPen = (HPEN)SelectObject(hdc, brickPen);
|
||||
oldBrush = (HBRUSH)SelectObject(hdc, brickBrush);
|
||||
RoundRect(hdc, brickRect.left, brickRect.top, brickRect.right, brickRect.bottom, SS(12), SS(12));
|
||||
SelectObject(hdc, oldBrush);
|
||||
SelectObject(hdc, oldPen);
|
||||
DeleteObject(brickBrush);
|
||||
DeleteObject(brickPen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user