mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Cleanup of some menus, added editor button, added disconnect question
This commit is contained in:
parent
659651adf7
commit
15ff17d8f8
|
@ -664,17 +664,25 @@ int CMenus::RenderMenubar(CUIRect r)
|
|||
box.VSplitRight(30.0f, &box, 0);
|
||||
*/
|
||||
|
||||
Box.VSplitRight(90.0f, &Box, &Button);
|
||||
Box.VSplitRight(30.0f, &Box, &Button);
|
||||
static int s_QuitButton=0;
|
||||
if(DoButton_MenuTab(&s_QuitButton, Localize("Quit"), 0, &Button, CUI::CORNER_T))
|
||||
if(DoButton_MenuTab(&s_QuitButton, "×", 0, &Button, CUI::CORNER_T))
|
||||
m_Popup = POPUP_QUIT;
|
||||
|
||||
Box.VSplitRight(10.0f, &Box, &Button);
|
||||
Box.VSplitRight(130.0f, &Box, &Button);
|
||||
Box.VSplitRight(30.0f, &Box, &Button);
|
||||
static int s_SettingsButton=0;
|
||||
if(DoButton_MenuTab(&s_SettingsButton, Localize("Settings"), m_ActivePage==PAGE_SETTINGS, &Button, CUI::CORNER_T))
|
||||
if(DoButton_MenuTab(&s_SettingsButton, "⚙", m_ActivePage==PAGE_SETTINGS, &Button, CUI::CORNER_T))
|
||||
NewPage = PAGE_SETTINGS;
|
||||
|
||||
Box.VSplitRight(10.0f, &Box, &Button);
|
||||
Box.VSplitRight(30.0f, &Box, &Button);
|
||||
static int s_EditorButton=0;
|
||||
if(DoButton_MenuTab(&s_EditorButton, Localize("✎"), 0, &Button, CUI::CORNER_T))
|
||||
{
|
||||
g_Config.m_ClEditor = 1;
|
||||
}
|
||||
|
||||
if(NewPage != -1)
|
||||
{
|
||||
if(Client()->State() == IClient::STATE_OFFLINE)
|
||||
|
@ -1047,6 +1055,12 @@ int CMenus::Render()
|
|||
pExtraText = Localize("Are you sure that you want to quit?");
|
||||
ExtraAlign = -1;
|
||||
}
|
||||
else if(m_Popup == POPUP_DISCONNECT)
|
||||
{
|
||||
pTitle = Localize("Disconnect");
|
||||
pExtraText = Localize("Are you sure that you want to disconnect?");
|
||||
ExtraAlign = -1;
|
||||
}
|
||||
else if(m_Popup == POPUP_FIRST_LAUNCH)
|
||||
{
|
||||
pTitle = Localize("Welcome to Teeworlds");
|
||||
|
@ -1121,6 +1135,30 @@ int CMenus::Render()
|
|||
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || m_EnterPressed)
|
||||
Client()->Quit();
|
||||
}
|
||||
if(m_Popup == POPUP_DISCONNECT)
|
||||
{
|
||||
CUIRect Yes, No;
|
||||
Box.HSplitBottom(20.f, &Box, &Part);
|
||||
#if defined(__ANDROID__)
|
||||
Box.HSplitBottom(60.f, &Box, &Part);
|
||||
#else
|
||||
Box.HSplitBottom(24.f, &Box, &Part);
|
||||
#endif
|
||||
|
||||
// buttons
|
||||
Part.VMargin(80.0f, &Part);
|
||||
Part.VSplitMid(&No, &Yes);
|
||||
Yes.VMargin(20.0f, &Yes);
|
||||
No.VMargin(20.0f, &No);
|
||||
|
||||
static int s_ButtonAbort = 0;
|
||||
if(DoButton_Menu(&s_ButtonAbort, Localize("No"), 0, &No) || m_EscapePressed)
|
||||
m_Popup = POPUP_NONE;
|
||||
|
||||
static int s_ButtonTryAgain = 0;
|
||||
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || m_EnterPressed)
|
||||
Client()->Disconnect();
|
||||
}
|
||||
#if !defined(CONF_PLATFORM_MACOSX) && !defined(__ANDROID__)
|
||||
else if(m_Popup == POPUP_AUTOUPDATE)
|
||||
{
|
||||
|
|
|
@ -327,7 +327,8 @@ public:
|
|||
POPUP_SOUNDERROR,
|
||||
POPUP_PASSWORD,
|
||||
POPUP_QUIT,
|
||||
POPUP_AUTOUPDATE
|
||||
POPUP_AUTOUPDATE,
|
||||
POPUP_DISCONNECT
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -52,7 +52,10 @@ void CMenus::RenderGame(CUIRect MainView)
|
|||
ButtonBar.VSplitRight(120.0f, &ButtonBar, &Button);
|
||||
static int s_DisconnectButton = 0;
|
||||
if(DoButton_Menu(&s_DisconnectButton, Localize("Disconnect"), 0, &Button))
|
||||
Client()->Disconnect();
|
||||
{
|
||||
m_Popup = POPUP_DISCONNECT;
|
||||
//Client()->Disconnect();
|
||||
}
|
||||
|
||||
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pGameInfoObj)
|
||||
{
|
||||
|
|
|
@ -541,6 +541,10 @@ void CPlayers::RenderPlayer(
|
|||
{
|
||||
if (Player.m_PlayerFlags&PLAYERFLAG_AIM && (g_Config.m_ClShowOtherHookColl || pPlayerInfo->m_Local))
|
||||
{
|
||||
float Alpha = 1.0f;
|
||||
if (OtherTeam)
|
||||
Alpha = g_Config.m_ClShowOthersAlpha / 100.0f;
|
||||
|
||||
vec2 ExDirection = Direction;
|
||||
|
||||
if (pPlayerInfo->m_Local && Client()->State() != IClient::STATE_DEMOPLAYBACK)
|
||||
|
@ -551,7 +555,7 @@ void CPlayers::RenderPlayer(
|
|||
vec2 finishPos = initPos + ExDirection * (m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookLength-42.0f);
|
||||
|
||||
Graphics()->LinesBegin();
|
||||
Graphics()->SetColor(1.00f, 0.0f, 0.0f, 1.00f);
|
||||
Graphics()->SetColor(1.00f, 0.0f, 0.0f, Alpha);
|
||||
|
||||
float PhysSize = 28.0f;
|
||||
|
||||
|
@ -561,10 +565,6 @@ void CPlayers::RenderPlayer(
|
|||
bool doBreak = false;
|
||||
int Hit = 0;
|
||||
|
||||
float Alpha = 1.0f;
|
||||
if (OtherTeam)
|
||||
Alpha = g_Config.m_ClShowOthersAlpha / 100.0f;
|
||||
|
||||
do {
|
||||
OldPos = NewPos;
|
||||
NewPos = OldPos + ExDirection * m_pClient->m_Tuning[g_Config.m_ClDummy].m_HookFireSpeed;
|
||||
|
|
Loading…
Reference in a new issue