1 (* Copyright (C) Doom 2D: Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *)
15 {$INCLUDE ../../shared/a_modes.inc}
18 interface
20 uses
21 {$IFDEF ENABLE_MENU}
22 g_gui,
23 {$ENDIF}
24 g_base // TRectWH
25 ;
44 {$IFDEF ENABLE_GIBS}
46 {$ENDIF}
48 {$IFDEF ENABLE_GFX}
50 {$ENDIF}
52 {$IFDEF ENABLE_TOUCH}
53 // touch screen button location and size
55 {$ENDIF}
57 {$IFDEF ENABLE_MENU}
62 {$ENDIF}
66 implementation
68 uses
69 {$INCLUDE ../../nogl/noGLuses.inc}
70 {$IFDEF ENABLE_TOUCH}
71 r_touch,
72 {$ENDIF}
73 {$IFDEF ENABLE_GFX}
74 r_gfx,
75 {$ENDIF}
76 {$IFDEF ENABLE_SYSTEM}
77 g_system,
78 {$ENDIF}
79 {$IFDEF ENABLE_MENU}
80 r_gui,
81 {$ENDIF}
87 ;
89 var
94 begin
98 begin
104 begin
111 end
112 end
117 begin
118 {$IFDEF NOGL_INIT}
120 {$ELSE}
123 begin
125 begin
127 exit
128 end
129 end
130 {$ENDIF}
134 begin
140 begin
146 begin
155 begin
156 {$IFNDEF USE_SYSSTUB}
157 PrintGLSupportedExtensions;
159 {$ELSE}
162 {$ENDIF}
164 begin
167 end
168 else
169 begin
172 else
174 end
179 begin
181 begin
182 {$IFDEF NOGL_INIT}
183 nogl_Init;
184 {$ENDIF}
186 begin
188 {$IFDEF NOGL_INIT}
190 {$ELSE}
192 {$ENDIF}
194 begin
200 end
204 begin
206 begin
207 {$IFDEF NOGL_INIT}
208 nogl_Quit;
209 {$ENDIF}
211 end
215 begin
216 r_Game_LoadTextures;
217 r_Map_LoadTextures;
221 begin
222 r_Map_FreeTextures;
223 r_Game_FreeTextures;
227 begin
229 r_Player_Load;
230 r_Map_Load;
231 r_PlayerModel_Load;
232 r_Monsters_Load;
233 r_Weapon_Load;
234 r_Items_Load;
235 {$IFDEF ENABLE_GFX}
236 r_GFX_Load;
237 {$ENDIF}
238 {$IFDEF ENABLE_MENU}
239 r_GUI_Load;
240 {$ENDIF}
244 begin
245 {$IFDEF ENABLE_MENU}
246 r_GUI_Free;
247 {$ENDIF}
248 {$IFDEF ENABLE_GFX}
249 r_GFX_Free;
250 {$ENDIF}
251 r_Items_Free;
252 r_Weapon_Free;
253 r_Monsters_Free;
254 r_PlayerModel_Free;
255 r_Map_Free;
256 r_Player_Free;
257 r_Game_Free;
258 g_Texture_DeleteAll;
259 g_Frames_DeleteAll;
263 begin
264 {$IFDEF ENABLE_SYSTEM}
267 {$ENDIF}
268 LoadGL;
269 r_Window_Initialize;
270 r_Console_Init;
271 r_PlayerModel_Initialize;
272 r_Map_Initialize;
276 begin
277 r_Map_Finalize;
278 r_PlayerModel_Finalize;
279 FreeGL;
280 e_ReleaseEngine
284 begin
285 {$IFDEF ENABLE_GFX}
286 r_GFX_Update;
287 {$ENDIF}
288 r_Map_Update;
289 r_PlayerModel_Update;
290 r_Console_Update;
291 r_Items_Update;
295 begin
296 r_Game_Draw;
297 {$IFDEF ENABLE_TOUCH}
298 r_Touch_Draw;
299 {$ENDIF}
303 begin
304 LoadGL;
310 begin
311 // store real window size in gWinSize, downscale resolution now
315 begin
325 e_InitGL;
326 r_Game_SetupScreenSize;
330 begin
331 {$IFDEF ENABLE_SYSTEM}
332 if sys_SetDisplayMode(Max(1, gRC_Width), Max(1, gRC_Height), Max(1, gBPP), gRC_FullScreen, gRC_Maximized) then
334 else
337 {$ENDIF}
342 begin
344 try
346 try
349 except
353 finally
354 end
357 {$IFDEF ENABLE_GIBS}
359 begin
362 {$ENDIF}
364 {$IFDEF ENABLE_GFX}
366 begin
369 {$ENDIF}
371 {$IFDEF ENABLE_TOUCH}
373 begin
376 {$ENDIF}
378 {$IFDEF ENABLE_MENU}
380 begin
385 begin
390 begin
395 begin
398 {$ENDIF}
401 begin