mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
moved game buttons to the top. #1698
This commit is contained in:
parent
3bb6f9d959
commit
5768a35018
|
@ -52,45 +52,38 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
CSwitchTeamInfo Info;
|
CSwitchTeamInfo Info;
|
||||||
GetSwitchTeamInfo(&Info);
|
GetSwitchTeamInfo(&Info);
|
||||||
CUIRect Button, BottomView, Left, Middle, Right;
|
CUIRect Button, ButtonRow, Label;
|
||||||
|
|
||||||
// cut view
|
|
||||||
MainView.HSplitBottom(80.0f, &MainView, &BottomView); // MainView not used for now
|
|
||||||
BottomView.HSplitTop(20.f, 0, &BottomView);
|
|
||||||
|
|
||||||
float Spacing = 3.0f;
|
float Spacing = 3.0f;
|
||||||
float ButtonWidth = (BottomView.w/6.0f)-(Spacing*5.0)/6.0f;
|
float ButtonWidth = (MainView.w/6.0f)-(Spacing*5.0)/6.0f;
|
||||||
|
|
||||||
BottomView.VSplitLeft(ButtonWidth*3.0f+Spacing*2.0f, &Left, &Middle);
|
// cut view
|
||||||
Middle.VSplitLeft(Spacing, 0, &Middle);
|
MainView.HSplitTop(20.0f, 0, &MainView);
|
||||||
Middle.VSplitLeft(ButtonWidth, &Middle, &Right);
|
float NoteHeight = !Info.m_aNotification[0] ? 0.0f : 45.0f;
|
||||||
Right.VSplitRight(ButtonWidth, 0, &Right);
|
MainView.HSplitTop(20.0f+20.0f+2*Spacing+ NoteHeight, &MainView, 0);
|
||||||
if(!(m_pClient->m_GameInfo.m_GameFlags&GAMEFLAG_TEAMS))
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0f, 0.0f, 0.0f, 0.25f + ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f);
|
||||||
Left.VSplitLeft(ButtonWidth, &Left, 0);
|
|
||||||
|
|
||||||
// do backgrounds
|
// game options
|
||||||
RenderTools()->DrawUIRect4(&Left, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f);
|
MainView.HSplitTop(20.0f, &Label, &MainView);
|
||||||
RenderTools()->DrawUIRect4(&Middle, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f);
|
Label.y += 2.0f;
|
||||||
RenderTools()->DrawUIRect4(&Right, vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.25f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), CUI::CORNER_T, 5.0f);
|
UI()->DoLabel(&Label, Localize("Game options"), 20.0f*ms_FontmodHeight*0.8f, CUI::ALIGN_CENTER);
|
||||||
|
RenderTools()->DrawUIRect(&MainView, vec4(0.0, 0.0, 0.0, 0.25f), CUI::CORNER_ALL, 5.0f);
|
||||||
// do buttons
|
|
||||||
Left.HSplitTop(25.0f, &Left, 0);
|
|
||||||
Middle.HSplitTop(25.0f, &Middle, 0);
|
|
||||||
Right.HSplitTop(25.0f, &Right, 0);
|
|
||||||
|
|
||||||
if(Info.m_aNotification[0] != 0)
|
if(Info.m_aNotification[0] != 0)
|
||||||
{
|
{
|
||||||
// print notice
|
// print notice
|
||||||
CUIRect Bar;
|
CUIRect Bar;
|
||||||
MainView.HSplitTop(20.0f, 0, &MainView);
|
MainView.HSplitBottom(NoteHeight, &MainView, &Bar);
|
||||||
MainView.HSplitTop(45.0f, &Bar, &MainView);
|
|
||||||
RenderTools()->DrawUIRect(&Bar, vec4(0.0f, 0.0f, 0.0f, 0.25f+ms_BackgroundAlpha), CUI::CORNER_ALL, 5.0f);
|
|
||||||
Bar.HMargin(15.0f, &Bar);
|
Bar.HMargin(15.0f, &Bar);
|
||||||
UI()->DoLabelScaled(&Bar, Info.m_aNotification, 14.0f, CUI::ALIGN_CENTER);
|
UI()->DoLabelScaled(&Bar, Info.m_aNotification, 14.0f, CUI::ALIGN_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// join buttons
|
// buttons
|
||||||
{
|
{
|
||||||
|
MainView.HSplitTop(Spacing, 0, &MainView);
|
||||||
|
MainView.HSplitTop(20.0f, &ButtonRow, 0);
|
||||||
|
ButtonRow.VMargin(Spacing, &ButtonRow);
|
||||||
|
|
||||||
// specator button
|
// specator button
|
||||||
int Team = m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team;
|
int Team = m_pClient->m_aClients[m_pClient->m_LocalClientID].m_Team;
|
||||||
if(Info.m_aNotification[0] && Team != TEAM_SPECTATORS)
|
if(Info.m_aNotification[0] && Team != TEAM_SPECTATORS)
|
||||||
|
@ -103,8 +96,8 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
else
|
else
|
||||||
str_copy(aBuf, Localize(Team != TEAM_SPECTATORS ? "Spectate" : "Spectating"), sizeof(aBuf)); // Localize("Spectating");
|
str_copy(aBuf, Localize(Team != TEAM_SPECTATORS ? "Spectate" : "Spectating"), sizeof(aBuf)); // Localize("Spectating");
|
||||||
|
|
||||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
ButtonRow.VSplitLeft(ButtonWidth, &Button, &ButtonRow);
|
||||||
Left.VSplitLeft(Spacing, 0, &Left);
|
ButtonRow.VSplitLeft(Spacing, 0, &ButtonRow);
|
||||||
static CButtonContainer s_SpectateButton;
|
static CButtonContainer s_SpectateButton;
|
||||||
if(DoButton_Menu(&s_SpectateButton, aBuf, Team == TEAM_SPECTATORS, &Button) && Team != TEAM_SPECTATORS && Info.m_AllowSpec && !(Info.m_aNotification[0]))
|
if(DoButton_Menu(&s_SpectateButton, aBuf, Team == TEAM_SPECTATORS, &Button) && Team != TEAM_SPECTATORS && Info.m_AllowSpec && !(Info.m_aNotification[0]))
|
||||||
{
|
{
|
||||||
|
@ -125,8 +118,8 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
else
|
else
|
||||||
str_copy(aBuf, Localize(Team != TEAM_RED ? "Join red" : "Joined red"), sizeof(aBuf)); // Localize("Join red");Localize("Joined red");
|
str_copy(aBuf, Localize(Team != TEAM_RED ? "Join red" : "Joined red"), sizeof(aBuf)); // Localize("Join red");Localize("Joined red");
|
||||||
|
|
||||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
ButtonRow.VSplitLeft(ButtonWidth, &Button, &ButtonRow);
|
||||||
Left.VSplitLeft(Spacing, 0, &Left);
|
ButtonRow.VSplitLeft(Spacing, 0, &ButtonRow);
|
||||||
static CButtonContainer s_RedButton;
|
static CButtonContainer s_RedButton;
|
||||||
if(DoButton_Menu(&s_RedButton, aBuf, Team == TEAM_RED, &Button, 0, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.975f, 0.17f, 0.17f, 0.75f), false) && Team != TEAM_RED && !(Info.m_aNotification[0]))
|
if(DoButton_Menu(&s_RedButton, aBuf, Team == TEAM_RED, &Button, 0, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.975f, 0.17f, 0.17f, 0.75f), false) && Team != TEAM_RED && !(Info.m_aNotification[0]))
|
||||||
{
|
{
|
||||||
|
@ -144,7 +137,8 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
else
|
else
|
||||||
str_copy(aBuf, Localize(Team != TEAM_BLUE ? "Join blue" : "Joined blue"), sizeof(aBuf)); // Localize("Join blue");Localize("Joined blue");
|
str_copy(aBuf, Localize(Team != TEAM_BLUE ? "Join blue" : "Joined blue"), sizeof(aBuf)); // Localize("Join blue");Localize("Joined blue");
|
||||||
|
|
||||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
ButtonRow.VSplitLeft(ButtonWidth, &Button, &ButtonRow);
|
||||||
|
ButtonRow.VSplitLeft(Spacing, 0, &ButtonRow);
|
||||||
static CButtonContainer s_BlueButton;
|
static CButtonContainer s_BlueButton;
|
||||||
if(DoButton_Menu(&s_BlueButton, aBuf, Team == TEAM_BLUE, &Button, 0, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.17f, 0.46f, 0.975f, 0.75f), false) && Team != TEAM_BLUE && !(Info.m_aNotification[0]))
|
if(DoButton_Menu(&s_BlueButton, aBuf, Team == TEAM_BLUE, &Button, 0, CUI::CORNER_ALL, 5.0f, 0.0f, vec4(0.17f, 0.46f, 0.975f, 0.75f), false) && Team != TEAM_BLUE && !(Info.m_aNotification[0]))
|
||||||
{
|
{
|
||||||
|
@ -164,7 +158,7 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
else
|
else
|
||||||
str_copy(aBuf, Localize(Team != TEAM_RED ? "Join" : "Joined"), sizeof(aBuf)); //Localize("Join");Localize("Joined");
|
str_copy(aBuf, Localize(Team != TEAM_RED ? "Join" : "Joined"), sizeof(aBuf)); //Localize("Join");Localize("Joined");
|
||||||
|
|
||||||
Left.VSplitLeft(ButtonWidth, &Button, &Left);
|
ButtonRow.VSplitLeft(ButtonWidth, &Button, &ButtonRow);
|
||||||
static CButtonContainer s_JoinButton;
|
static CButtonContainer s_JoinButton;
|
||||||
if(DoButton_Menu(&s_JoinButton, aBuf, Team == TEAM_RED, &Button) && Team != TEAM_RED && !(Info.m_aNotification[0]))
|
if(DoButton_Menu(&s_JoinButton, aBuf, Team == TEAM_RED, &Button) && Team != TEAM_RED && !(Info.m_aNotification[0]))
|
||||||
{
|
{
|
||||||
|
@ -172,12 +166,13 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
SetActive(false);
|
SetActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Record button
|
// Record button
|
||||||
|
ButtonRow.VSplitLeft(50.0f, 0, &ButtonRow);
|
||||||
|
ButtonRow.VSplitLeft(ButtonWidth, &Button, &ButtonRow);
|
||||||
static CButtonContainer s_DemoButton;
|
static CButtonContainer s_DemoButton;
|
||||||
bool Recording = DemoRecorder()->IsRecording();
|
bool Recording = DemoRecorder()->IsRecording();
|
||||||
if(DoButton_Menu(&s_DemoButton, Localize(Recording ? "Stop record" : "Record"), Recording, &Middle)) // Localize("Stop record");Localize("Record");
|
if(DoButton_Menu(&s_DemoButton, Localize(Recording ? "Stop record" : "Record"), Recording, &Button)) // Localize("Stop record");Localize("Record");
|
||||||
{
|
{
|
||||||
if(!Recording)
|
if(!Recording)
|
||||||
Client()->DemoRecorder_Start("demo", true);
|
Client()->DemoRecorder_Start("demo", true);
|
||||||
|
@ -186,9 +181,11 @@ void CMenus::RenderGame(CUIRect MainView)
|
||||||
}
|
}
|
||||||
|
|
||||||
// disconnect button
|
// disconnect button
|
||||||
|
ButtonRow.VSplitRight(ButtonWidth, &ButtonRow, &Button);
|
||||||
static CButtonContainer s_DisconnectButton;
|
static CButtonContainer s_DisconnectButton;
|
||||||
if(DoButton_Menu(&s_DisconnectButton, Localize("Disconnect"), 0, &Right))
|
if(DoButton_Menu(&s_DisconnectButton, Localize("Disconnect"), 0, &Button))
|
||||||
Client()->Disconnect();
|
Client()->Disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenus::RenderPlayers(CUIRect MainView)
|
void CMenus::RenderPlayers(CUIRect MainView)
|
||||||
|
|
Loading…
Reference in a new issue