添加粒子效果
This commit is contained in:
@@ -839,6 +839,87 @@ void TDrawScreen(HDC hdc, HWND hWnd)
|
||||
}
|
||||
}
|
||||
|
||||
if (clearEffectState.ticks > 0 && clearEffectState.totalTicks > 0)
|
||||
{
|
||||
int elapsed = clearEffectState.totalTicks - clearEffectState.ticks;
|
||||
int alpha = 42 + clearEffectState.ticks * 150 / clearEffectState.totalTicks;
|
||||
int inset = SS(elapsed * 2);
|
||||
Graphics flashGraphics(hdc);
|
||||
|
||||
for (int i = 0; i < clearEffectState.rowCount; i++)
|
||||
{
|
||||
int row = clearEffectState.rows[i];
|
||||
if (row < 0 || row >= nGameHeight)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int top = gameRect.top + row * grid + inset;
|
||||
int height = grid - inset * 2;
|
||||
if (height < SS(4))
|
||||
{
|
||||
height = SS(4);
|
||||
}
|
||||
|
||||
SolidBrush flashBrush(Color(alpha, 255, 248, 174));
|
||||
flashGraphics.FillRectangle(
|
||||
&flashBrush,
|
||||
static_cast<INT>(gameRect.left + SS(2)),
|
||||
static_cast<INT>(top),
|
||||
static_cast<INT>(gameRect.right - gameRect.left - SS(4)),
|
||||
static_cast<INT>(height));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
if (particleEffects[i].ticks <= 0 || particleEffects[i].totalTicks <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int elapsed = particleEffects[i].totalTicks - particleEffects[i].ticks;
|
||||
int particleX = gameRect.left + particleEffects[i].boardX * grid / 100 + SS(particleEffects[i].velocityX * elapsed / 2);
|
||||
int particleY = gameRect.top + particleEffects[i].boardY * grid / 100 + SS(particleEffects[i].velocityY * elapsed / 2 + elapsed * elapsed / 10);
|
||||
int particleSize = SS(3 + (elapsed % 2));
|
||||
|
||||
RECT particleRect =
|
||||
{
|
||||
particleX - particleSize,
|
||||
particleY - particleSize,
|
||||
particleX + particleSize,
|
||||
particleY + particleSize
|
||||
};
|
||||
|
||||
HBRUSH particleBrush = CreateSolidBrush(particleEffects[i].color);
|
||||
FillRect(hdc, &particleRect, particleBrush);
|
||||
DeleteObject(particleBrush);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (floatingTextEffects[i].ticks <= 0 || floatingTextEffects[i].totalTicks <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int elapsed = floatingTextEffects[i].totalTicks - floatingTextEffects[i].ticks;
|
||||
int textX = gameRect.left + floatingTextEffects[i].boardX * grid / 100;
|
||||
int textY = gameRect.top + floatingTextEffects[i].boardY * grid / 100 - SS(elapsed * 4);
|
||||
|
||||
HFONT oldFloatFont = (HFONT)SelectObject(hdc, sectionFont);
|
||||
SetTextColor(hdc, floatingTextEffects[i].color);
|
||||
RECT floatRect =
|
||||
{
|
||||
textX - SS(160),
|
||||
textY - SS(24),
|
||||
textX + SS(160),
|
||||
textY + SS(28)
|
||||
};
|
||||
DrawText(hdc, floatingTextEffects[i].text, -1, &floatRect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||||
SelectObject(hdc, oldFloatFont);
|
||||
}
|
||||
|
||||
HFONT oldFont = (HFONT)SelectObject(hdc, titleFont);
|
||||
DrawPanelHeader(leftPanelRect, _T("战局信息"), 120);
|
||||
DrawPanelHeader(rightPanelRect, _T("预览与战术"), 148);
|
||||
|
||||
Reference in New Issue
Block a user