mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Center more tees
This commit is contained in:
parent
629310768d
commit
7c992e296a
|
@ -173,6 +173,8 @@ void CHud::RenderScoreHud()
|
|||
float Whole = 300 * Graphics()->ScreenAspect();
|
||||
float StartY = 229.0f;
|
||||
|
||||
const float ScoreSingleBoxHeight = 18.0f;
|
||||
|
||||
bool ForceScoreInfoInit = !m_aScoreInfo[0].m_Initialized || !m_aScoreInfo[1].m_Initialized;
|
||||
m_aScoreInfo[0].m_Initialized = m_aScoreInfo[1].m_Initialized = true;
|
||||
|
||||
|
@ -215,7 +217,7 @@ void CHud::RenderScoreHud()
|
|||
Graphics()->SetColor(1.0f, 0.0f, 0.0f, 0.25f);
|
||||
else
|
||||
Graphics()->SetColor(0.0f, 0.0f, 1.0f, 0.25f);
|
||||
m_aScoreInfo[t].m_RoundRectQuadContainerIndex = RenderTools()->CreateRoundRectQuadContainer(Whole - ScoreWidthMax - ImageSize - 2 * Split, StartY + t * 20, ScoreWidthMax + ImageSize + 2 * Split, 18.0f, 5.0f, CUI::CORNER_L);
|
||||
m_aScoreInfo[t].m_RoundRectQuadContainerIndex = RenderTools()->CreateRoundRectQuadContainer(Whole - ScoreWidthMax - ImageSize - 2 * Split, StartY + t * 20, ScoreWidthMax + ImageSize + 2 * Split, ScoreSingleBoxHeight, 5.0f, CUI::CORNER_L);
|
||||
}
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
@ -282,10 +284,15 @@ void CHud::RenderScoreHud()
|
|||
}
|
||||
|
||||
// draw tee of the flag holder
|
||||
CTeeRenderInfo Info = m_pClient->m_aClients[ID].m_RenderInfo;
|
||||
Info.m_Size = 18.0f;
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1, 0),
|
||||
vec2(Whole - ScoreWidthMax - Info.m_Size / 2 - Split, StartY + 1.0f + Info.m_Size / 2 + t * 20));
|
||||
CTeeRenderInfo TeeInfo = m_pClient->m_aClients[ID].m_RenderInfo;
|
||||
TeeInfo.m_Size = ScoreSingleBoxHeight;
|
||||
|
||||
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||
vec2 OffsetToMid;
|
||||
RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
|
||||
vec2 TeeRenderPos(Whole - ScoreWidthMax - TeeInfo.m_Size / 2 - Split, StartY + (t * 20) + ScoreSingleBoxHeight / 2.0f + OffsetToMid.y);
|
||||
|
||||
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_NORMAL, vec2(1.0f, 0.0f), TeeRenderPos);
|
||||
}
|
||||
}
|
||||
StartY += 8.0f;
|
||||
|
@ -391,7 +398,7 @@ void CHud::RenderScoreHud()
|
|||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.25f);
|
||||
else
|
||||
Graphics()->SetColor(0.0f, 0.0f, 0.0f, 0.25f);
|
||||
m_aScoreInfo[t].m_RoundRectQuadContainerIndex = RenderTools()->CreateRoundRectQuadContainer(Whole - ScoreWidthMax - ImageSize - 2 * Split - PosSize, StartY + t * 20, ScoreWidthMax + ImageSize + 2 * Split + PosSize, 18.0f, 5.0f, CUI::CORNER_L);
|
||||
m_aScoreInfo[t].m_RoundRectQuadContainerIndex = RenderTools()->CreateRoundRectQuadContainer(Whole - ScoreWidthMax - ImageSize - 2 * Split - PosSize, StartY + t * 20, ScoreWidthMax + ImageSize + 2 * Split + PosSize, ScoreSingleBoxHeight, 5.0f, CUI::CORNER_L);
|
||||
}
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
@ -446,10 +453,15 @@ void CHud::RenderScoreHud()
|
|||
}
|
||||
|
||||
// draw tee
|
||||
CTeeRenderInfo Info = m_pClient->m_aClients[ID].m_RenderInfo;
|
||||
Info.m_Size = 18.0f;
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1, 0),
|
||||
vec2(Whole - ScoreWidthMax - Info.m_Size / 2 - Split, StartY + 1.0f + Info.m_Size / 2 + t * 20));
|
||||
CTeeRenderInfo TeeInfo = m_pClient->m_aClients[ID].m_RenderInfo;
|
||||
TeeInfo.m_Size = ScoreSingleBoxHeight;
|
||||
|
||||
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||
vec2 OffsetToMid;
|
||||
RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
|
||||
vec2 TeeRenderPos(Whole - ScoreWidthMax - TeeInfo.m_Size / 2 - Split, StartY + (t * 20) + ScoreSingleBoxHeight / 2.0f + OffsetToMid.y);
|
||||
|
||||
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_NORMAL, vec2(1.0f, 0.0f), TeeRenderPos);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -221,7 +221,17 @@ void CKillMessages::OnRender()
|
|||
}
|
||||
|
||||
if(m_aKillmsgs[r].m_VictimID >= 0)
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &m_aKillmsgs[r].m_VictimRenderInfo, EMOTE_PAIN, vec2(-1, 0), vec2(x, y + 28));
|
||||
{
|
||||
CTeeRenderInfo TeeInfo = m_aKillmsgs[r].m_VictimRenderInfo;
|
||||
|
||||
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||
vec2 OffsetToMid;
|
||||
RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
|
||||
vec2 TeeRenderPos(x, y + 46.0f / 2.0f + OffsetToMid.y);
|
||||
|
||||
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_PAIN, vec2(-1, 0), TeeRenderPos);
|
||||
}
|
||||
|
||||
x -= 32.0f;
|
||||
|
||||
// render weapon
|
||||
|
@ -254,8 +264,19 @@ void CKillMessages::OnRender()
|
|||
|
||||
// render killer tee
|
||||
x -= 24.0f;
|
||||
|
||||
if(m_aKillmsgs[r].m_KillerID >= 0)
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &m_aKillmsgs[r].m_KillerRenderInfo, EMOTE_ANGRY, vec2(1, 0), vec2(x, y + 28));
|
||||
{
|
||||
CTeeRenderInfo TeeInfo = m_aKillmsgs[r].m_KillerRenderInfo;
|
||||
|
||||
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||
vec2 OffsetToMid;
|
||||
RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
|
||||
vec2 TeeRenderPos(x, y + 46.0f / 2.0f + OffsetToMid.y);
|
||||
|
||||
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_ANGRY, vec2(1, 0), TeeRenderPos);
|
||||
}
|
||||
|
||||
x -= 32.0f;
|
||||
|
||||
// render killer name
|
||||
|
|
|
@ -293,9 +293,16 @@ void CMenus::RenderPlayers(CUIRect MainView)
|
|||
|
||||
// player info
|
||||
Player.VSplitLeft(28.0f, &Button, &Player);
|
||||
CTeeRenderInfo Info = m_pClient->m_aClients[Index].m_RenderInfo;
|
||||
Info.m_Size = Button.h;
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1.0f, 0.0f), vec2(Button.x + Button.h / 2, Button.y + Button.h / 2));
|
||||
|
||||
CTeeRenderInfo TeeInfo = m_pClient->m_aClients[Index].m_RenderInfo;
|
||||
TeeInfo.m_Size = Button.h;
|
||||
|
||||
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||
vec2 OffsetToMid;
|
||||
RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
|
||||
vec2 TeeRenderPos(Button.x + Button.h / 2, Button.y + Button.h / 2 + OffsetToMid.y);
|
||||
|
||||
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_NORMAL, vec2(1.0f, 0.0f), TeeRenderPos);
|
||||
|
||||
Player.HSplitTop(1.5f, 0, &Player);
|
||||
Player.VSplitMid(&Player, &Button);
|
||||
|
@ -589,10 +596,17 @@ bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators)
|
|||
|
||||
if(Item.m_Visible)
|
||||
{
|
||||
CTeeRenderInfo Info = m_pClient->m_aClients[aPlayerIDs[i]].m_RenderInfo;
|
||||
Info.m_Size = Item.m_Rect.h;
|
||||
RenderTools()->RenderTee(CAnimState::GetIdle(), &Info, EMOTE_NORMAL, vec2(1, 0), vec2(Item.m_Rect.x + Item.m_Rect.h / 2, Item.m_Rect.y + Item.m_Rect.h / 2));
|
||||
Item.m_Rect.x += Info.m_Size;
|
||||
CTeeRenderInfo TeeInfo = m_pClient->m_aClients[aPlayerIDs[i]].m_RenderInfo;
|
||||
TeeInfo.m_Size = Item.m_Rect.h;
|
||||
|
||||
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||
vec2 OffsetToMid;
|
||||
RenderTools()->GetRenderTeeOffsetToRenderedTee(pIdleState, &TeeInfo, OffsetToMid);
|
||||
vec2 TeeRenderPos(Item.m_Rect.x + Item.m_Rect.h / 2, Item.m_Rect.y + Item.m_Rect.h / 2 + OffsetToMid.y);
|
||||
|
||||
RenderTools()->RenderTee(pIdleState, &TeeInfo, EMOTE_NORMAL, vec2(1.0f, 0.0f), TeeRenderPos);
|
||||
|
||||
Item.m_Rect.x += TeeInfo.m_Size;
|
||||
UI()->DoLabelScaled(&Item.m_Rect, m_pClient->m_aClients[aPlayerIDs[i]].m_aName, 16.0f, -1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue