1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/* (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/keys.h>
#include <engine/textrender.h>
#include <engine/shared/config.h>
#include <game/version.h>
#include <game/client/render.h>
#include <game/client/ui.h>
#include <generated/client_data.h>
#include "menus.h"
void CMenus::RenderStartMenu(CUIRect MainView)
{
// render logo
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BANNER].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1,1,1,1);
IGraphics::CQuadItem QuadItem(MainView.w/2-140, 60, 280, 70);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
const float Rounding = 10.0f;
CUIRect TopMenu, BottomMenu;
MainView.VMargin(MainView.w/2-190.0f, &TopMenu);
TopMenu.HSplitTop(365.0f, &TopMenu, &BottomMenu);
//TopMenu.HSplitBottom(145.0f, &TopMenu, 0);
RenderBackgroundShadow(&TopMenu, false, Rounding);
TopMenu.HSplitTop(145.0f, 0, &TopMenu);
CUIRect Button;
int NewPage = -1;
TopMenu.HSplitBottom(40.0f, &TopMenu, &Button);
static CButtonContainer s_SettingsButton;
if(DoButton_Menu(&s_SettingsButton, Localize("Settings"), 0, &Button, Config()->m_ClShowStartMenuImages ? "settings" : 0, CUIRect::CORNER_ALL, Rounding, 0.5f) || CheckHotKey(KEY_S))
NewPage = PAGE_SETTINGS;
/*TopMenu.HSplitBottom(5.0f, &TopMenu, 0); // little space
TopMenu.HSplitBottom(40.0f, &TopMenu, &Bottom);
static int s_LocalServerButton = 0;
if(Config()->m_ClShowStartMenuImages)
{
if(DoButton_MenuImage(&s_LocalServerButton, Localize("Local server"), 0, &Button, "local_server", Rounding, 0.5f))
{
}
}
else
{
if(DoButton_Menu(&s_LocalServerButton, Localize("Local server"), 0, &Button, CUIRect::CORNER_ALL, Rounding, 0.5f))
{
}
}*/
TopMenu.HSplitBottom(5.0f, &TopMenu, 0); // little space
TopMenu.HSplitBottom(40.0f, &TopMenu, &Button);
static CButtonContainer s_DemoButton;
if(DoButton_Menu(&s_DemoButton, Localize("Demos"), 0, &Button, Config()->m_ClShowStartMenuImages ? "demos" : 0, CUIRect::CORNER_ALL, Rounding, 0.5f) || CheckHotKey(KEY_D))
{
NewPage = PAGE_DEMOS;
DemolistPopulate();
DemolistOnUpdate(false);
}
static bool EditorHotkeyWasPressed = true;
static float EditorHotKeyChecktime = 0;
TopMenu.HSplitBottom(5.0f, &TopMenu, 0); // little space
TopMenu.HSplitBottom(40.0f, &TopMenu, &Button);
static CButtonContainer s_MapEditorButton;
if(DoButton_Menu(&s_MapEditorButton, Localize("Editor"), 0, &Button, Config()->m_ClShowStartMenuImages ? "editor" : 0, CUIRect::CORNER_ALL, Rounding, 0.5f) || (!EditorHotkeyWasPressed && Client()->LocalTime() - EditorHotKeyChecktime < 0.1f && CheckHotKey(KEY_E)))
{
Config()->m_ClEditor = 1;
Input()->MouseModeRelative();
EditorHotkeyWasPressed = true;
}
if(!Input()->KeyIsPressed(KEY_E))
{
EditorHotkeyWasPressed = false;
EditorHotKeyChecktime = Client()->LocalTime();
}
TopMenu.HSplitBottom(5.0f, &TopMenu, 0); // little space
TopMenu.HSplitBottom(40.0f, &TopMenu, &Button);
static CButtonContainer s_PlayButton;
if(DoButton_Menu(&s_PlayButton, Localize("Play"), 0, &Button, Config()->m_ClShowStartMenuImages ? "play_game" : 0, CUIRect::CORNER_ALL, Rounding, 0.5f) || UI()->ConsumeHotkey(CUI::HOTKEY_ENTER) || CheckHotKey(KEY_P))
NewPage = Config()->m_UiBrowserPage;
BottomMenu.HSplitTop(90.0f, 0, &BottomMenu);
RenderBackgroundShadow(&BottomMenu, true, Rounding);
BottomMenu.HSplitTop(40.0f, &Button, &TopMenu);
static CButtonContainer s_QuitButton;
if(DoButton_Menu(&s_QuitButton, Localize("Quit"), 0, &Button, 0, CUIRect::CORNER_ALL, Rounding, 0.5f) || UI()->ConsumeHotkey(CUI::HOTKEY_ESCAPE) || CheckHotKey(KEY_Q))
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()->DoLabel(&Version, aBuf, 14.0f, TEXTALIGN_CENTER);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
}
UI()->DoLabel(&Version, GAME_RELEASE_VERSION, 14.0f, TEXTALIGN_RIGHT);
if(NewPage != -1)
SetMenuPage(NewPage);
}
void CMenus::RenderLogo(CUIRect MainView)
{
}
|