]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/mainwindow.c
9162c850dad5a10c2533b3327078e956e085fd9e
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / mainwindow.c
1 #ifdef INTERFACE
2 CLASS(MainWindow) EXTENDS(ModalController)
3         METHOD(MainWindow, configureMainWindow, void(entity))
4         METHOD(MainWindow, draw, void(entity))
5         ATTRIB(MainWindow, firstRunDialog, entity, NULL)
6         ATTRIB(MainWindow, advancedDialog, entity, NULL)
7         ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
8         ATTRIB(MainWindow, weaponsDialog, entity, NULL)
9         ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
10         ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
11         ATTRIB(MainWindow, winnerDialog, entity, NULL)
12         ATTRIB(MainWindow, waypointDialog, entity, NULL)
13         ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
14         ATTRIB(MainWindow, cvarsDialog, entity, NULL)
15         ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
16         ATTRIB(MainWindow, mainNexposee, entity, NULL)
17         ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
18         ATTRIB(MainWindow, dialogToShow, entity, NULL)
19 ENDCLASS(MainWindow)
20 #endif
21
22 #ifdef IMPLEMENTATION
23 void MainWindow_draw(entity me)
24 {
25         SUPER(MainWindow).draw(me);
26
27         if(me.dialogToShow)
28         {
29                 DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
30                 me.dialogToShow = NULL;
31         }
32 }
33
34 void DemoButton_Click(entity me, entity other)
35 {
36         if(me.text == _("Do not press this button again!"))
37                 DialogOpenButton_Click(me, other);
38         else
39                 me.setText(me, _("Do not press this button again!"));
40 }
41
42 void MainWindow_configureMainWindow(entity me)
43 {
44         entity n, i;
45
46         me.firstRunDialog = i = spawnXonoticFirstRunDialog();
47         i.configureDialog(i);
48         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
49
50         i = spawnXonoticTeamSelectDialog();
51         i.configureDialog(i);
52         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
53         
54         i = spawnXonoticHUDExitDialog();
55         i.configureDialog(i);
56         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
57         
58         i = spawnXonoticHUDNotificationDialog();
59         i.configureDialog(i);
60         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
61         
62         i = spawnXonoticHUDAmmoDialog();
63         i.configureDialog(i);
64         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
65         
66         i = spawnXonoticHUDHealthArmorDialog();
67         i.configureDialog(i);
68         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
69         
70         i = spawnXonoticHUDChatDialog();
71         i.configureDialog(i);
72         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
73         
74         i = spawnXonoticHUDModIconsDialog();
75         i.configureDialog(i);
76         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
77         
78         i = spawnXonoticHUDPowerupsDialog();
79         i.configureDialog(i);
80         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
81         
82         i = spawnXonoticHUDPressedKeysDialog();
83         i.configureDialog(i);
84         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
85         
86         i = spawnXonoticHUDRaceTimerDialog();
87         i.configureDialog(i);
88         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
89         
90         i = spawnXonoticHUDRadarDialog();
91         i.configureDialog(i);
92         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
93         
94         i = spawnXonoticHUDScoreDialog();
95         i.configureDialog(i);
96         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
97         
98         i = spawnXonoticHUDTimerDialog();
99         i.configureDialog(i);
100         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
101         
102         i = spawnXonoticHUDVoteDialog();
103         i.configureDialog(i);
104         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
105         
106         i = spawnXonoticHUDWeaponsDialog();
107         i.configureDialog(i);
108         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
109
110         i = spawnXonoticHUDEngineInfoDialog();
111         i.configureDialog(i);
112         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
113
114         i = spawnXonoticHUDInfoMessagesDialog();
115         i.configureDialog(i);
116         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
117         
118         i = spawnXonoticHUDPhysicsDialog();
119         i.configureDialog(i);
120         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
121         
122         me.screenshotViewerDialog = i = spawnXonoticScreenshotViewerDialog();
123         i.configureDialog(i);
124         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
125
126         me.advancedDialog = i = spawnXonoticAdvancedDialog();
127         i.configureDialog(i);
128         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
129
130         me.mutatorsDialog = i = spawnXonoticMutatorsDialog();
131         i.configureDialog(i);
132         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
133
134         me.mapInfoDialog = i = spawnXonoticMapInfoDialog();
135         i.configureDialog(i);
136         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
137
138         me.userbindEditDialog = i = spawnXonoticUserbindEditDialog();
139         i.configureDialog(i);
140         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
141
142         me.winnerDialog = i = spawnXonoticWinnerDialog();
143         i.configureDialog(i);
144         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
145
146         me.weaponsDialog = i = spawnXonoticWeaponsDialog();
147         i.configureDialog(i);
148         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
149
150         me.waypointDialog = i = spawnXonoticWaypointDialog();
151         i.configureDialog(i);
152         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
153         
154         me.serverInfoDialog = i = spawnXonoticServerInfoDialog();
155         i.configureDialog(i);
156         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
157         
158         me.cvarsDialog = i = spawnXonoticCvarsDialog();
159         i.configureDialog(i);
160         me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
161         
162         me.mainNexposee = n = spawnXonoticNexposee();
163         /*
164                 if(checkextension("DP_GECKO_SUPPORT"))
165                 {
166                         i = spawnXonoticNewsDialog();
167                         i.configureDialog(i);
168                         n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
169                         n.setNexposee(n, i, '0.1 0.1 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
170                 }
171         */
172                 i = spawnXonoticSingleplayerDialog();
173                 i.configureDialog(i);
174                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
175                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SINGLEPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
176                 
177                 i = spawnXonoticMultiplayerDialog();
178                 i.configureDialog(i);
179                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
180                 n.setNexposee(n, i, SKINPOSITION_DIALOG_MULTIPLAYER, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
181
182                 i = spawnXonoticSettingsDialog();
183                 i.configureDialog(i);
184                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
185                 n.setNexposee(n, i, SKINPOSITION_DIALOG_SETTINGS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
186
187                 i = spawnXonoticCreditsDialog();
188                 i.configureDialog(i);
189                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
190                 n.setNexposee(n, i, SKINPOSITION_DIALOG_CREDITS, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
191                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
192
193                 i = spawnXonoticQuitDialog();
194                 i.configureDialog(i);
195                 n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
196                 n.setNexposee(n, i, SKINPOSITION_DIALOG_QUIT, SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
197                 n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
198         me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
199         me.moveItemAfter(me, n, NULL);
200
201         me.initializeDialog(me, n);
202
203         if(cvar_string("_cl_name") == "Player")
204                 me.dialogToShow = me.firstRunDialog;
205 }
206 #endif
207
208 /* Click. The c-word is here so you can grep for it :-) */