mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
-fixed fade in graphics settings menu -added version to start menu
This commit is contained in:
parent
eb14096077
commit
0e3c8e4bba
|
@ -645,10 +645,11 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
|
||||
// display mode list
|
||||
static float s_ScrollValue = 0;
|
||||
static int s_DisplayModeList = 0;
|
||||
int OldSelected = -1;
|
||||
int G = gcd(s_GfxScreenWidth, s_GfxScreenHeight);
|
||||
str_format(aBuf, sizeof(aBuf), "%s: %dx%d %d bit (%d:%d)", Localize("Current"), s_GfxScreenWidth, s_GfxScreenHeight, s_GfxColorDepth, s_GfxScreenWidth/G, s_GfxScreenHeight/G);
|
||||
UiDoListboxStart(&s_NumNodes , &ModeList, 24.0f, Localize("Display Modes"), aBuf, s_NumNodes, 1, OldSelected, s_ScrollValue);
|
||||
UiDoListboxStart(&s_DisplayModeList , &ModeList, 24.0f, Localize("Display Modes"), aBuf, s_NumNodes, 1, OldSelected, s_ScrollValue);
|
||||
|
||||
for(int i = 0; i < s_NumNodes; ++i)
|
||||
{
|
||||
|
@ -769,6 +770,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
Localize("Lht."),
|
||||
Localize("Alpha")};
|
||||
int *pColorSlider[4] = {&g_Config.m_UiColorHue, &g_Config.m_UiColorSat, &g_Config.m_UiColorLht, &g_Config.m_UiColorAlpha};
|
||||
static int s_aColorSliders[4] = {0};
|
||||
for(int s = 0; s < 4; s++)
|
||||
{
|
||||
CUIRect Text;
|
||||
|
@ -779,7 +781,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
|
|||
Button.HSplitTop(4.0f, 0, &Button);
|
||||
|
||||
float k = (*pColorSlider[s]) / 255.0f;
|
||||
k = DoScrollbarH(pColorSlider[s], &Button, k);
|
||||
k = DoScrollbarH(&s_aColorSliders[s], &Button, k);
|
||||
*pColorSlider[s] = (int)(k*255.0f);
|
||||
UI()->DoLabelScaled(&Text, paLabels[s], 15.0f, -1);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||
#include <engine/graphics.h>
|
||||
#include <engine/textrender.h>
|
||||
|
||||
#include <engine/shared/config.h>
|
||||
|
||||
#include <game/version.h>
|
||||
#include <game/localization.h>
|
||||
#include <game/client/render.h>
|
||||
#include <game/client/ui.h>
|
||||
|
@ -14,21 +16,22 @@
|
|||
|
||||
void CMenus::RenderStartMenu(CUIRect MainView)
|
||||
{
|
||||
MainView.VMargin(MainView.w/2-190.0f, &MainView);
|
||||
MainView.HMargin(145.0f, &MainView);
|
||||
RenderTools()->DrawUIRect(&MainView, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 10.0f);
|
||||
CUIRect Menu;
|
||||
MainView.VMargin(MainView.w/2-190.0f, &Menu);
|
||||
Menu.HMargin(145.0f, &Menu);
|
||||
RenderTools()->DrawUIRect(&Menu, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 10.0f);
|
||||
|
||||
MainView.Margin(5.0f, &MainView);
|
||||
Menu.Margin(5.0f, &Menu);
|
||||
|
||||
CUIRect Button;
|
||||
|
||||
MainView.HSplitTop(40.0f, &Button, &MainView);
|
||||
Menu.HSplitTop(40.0f, &Button, &Menu);
|
||||
static int s_PlayButton = 0;
|
||||
if(DoButton_MenuImage(&s_PlayButton, Localize("Play Game"), 0, &Button, "play_game", 10.0f, 0.5f))
|
||||
m_MenuPage = MENU_PAGE;
|
||||
|
||||
MainView.HSplitTop(5.0f, 0, &MainView); // little space
|
||||
MainView.HSplitTop(40.0f, &Button, &MainView);
|
||||
Menu.HSplitTop(5.0f, 0, &Menu); // little space
|
||||
Menu.HSplitTop(40.0f, &Button, &Menu);
|
||||
static int s_MapEditorButton = 0;
|
||||
if(DoButton_MenuImage(&s_MapEditorButton, Localize("Map Editor"), 0, &Button, "editor", 10.0f, 0.5f))
|
||||
{
|
||||
|
@ -36,31 +39,45 @@ void CMenus::RenderStartMenu(CUIRect MainView)
|
|||
Input()->MouseModeRelative();
|
||||
}
|
||||
|
||||
MainView.HSplitTop(5.0f, 0, &MainView); // little space
|
||||
MainView.HSplitTop(40.0f, &Button, &MainView);
|
||||
Menu.HSplitTop(5.0f, 0, &Menu); // little space
|
||||
Menu.HSplitTop(40.0f, &Button, &Menu);
|
||||
static int s_DemoButton = 0;
|
||||
if(DoButton_MenuImage(&s_DemoButton, Localize("Demos"), 0, &Button, "demos", 10.0f, 0.5f))
|
||||
{
|
||||
}
|
||||
|
||||
MainView.HSplitTop(5.0f, 0, &MainView); // little space
|
||||
MainView.HSplitTop(40.0f, &Button, &MainView);
|
||||
Menu.HSplitTop(5.0f, 0, &Menu); // little space
|
||||
Menu.HSplitTop(40.0f, &Button, &Menu);
|
||||
static int s_LocalServerButton = 0;
|
||||
if(DoButton_MenuImage(&s_LocalServerButton, Localize("Create Local Server"), 0, &Button, "local_server", 10.0f, 0.5f))
|
||||
{
|
||||
}
|
||||
|
||||
MainView.HSplitTop(5.0f, 0, &MainView); // little space
|
||||
MainView.HSplitTop(40.0f, &Button, &MainView);
|
||||
Menu.HSplitTop(5.0f, 0, &Menu); // little space
|
||||
Menu.HSplitTop(40.0f, &Button, &Menu);
|
||||
static int s_SettingsButton = 0;
|
||||
if(DoButton_MenuImage(&s_SettingsButton, Localize("Settings"), 0, &Button, "settings", 10.0f, 0.5f))
|
||||
{
|
||||
}
|
||||
|
||||
MainView.HSplitBottom(45.0f, &MainView, &Button);
|
||||
Menu.HSplitBottom(45.0f, &Menu, &Button);
|
||||
static int s_QuitButton = 0;
|
||||
if(DoButton_Menu(&s_QuitButton, Localize("Quit Game"), 0, &Button, 15.0f, 0.5f))
|
||||
m_Popup = POPUP_QUIT;
|
||||
|
||||
// render version
|
||||
CUIRect Version;
|
||||
MainView.HSplitBottom(50.0f, 0, &Version);
|
||||
Version.VMargin(50.0f, &Version);
|
||||
char aBuf[64];
|
||||
if(str_comp(Client()->LatestVersion(), "0") != 0)
|
||||
{
|
||||
str_format(aBuf, sizeof(aBuf), Localize("Teeworlds %s is out! Download it at www.teeworlds.com!"), Client()->LatestVersion());
|
||||
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
|
||||
UI()->DoLabelScaled(&Version, aBuf, 14.0f, 0);
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
UI()->DoLabelScaled(&Version, GAME_VERSION, 14.0f, 1);
|
||||
}
|
||||
|
||||
void CMenus::RenderLogo(CUIRect MainView)
|
||||
|
|
Loading…
Reference in a new issue