DEADSOFTWARE

ba934c5ceedfa4d362c6a564aeb60ecd0c8edc65
[d2df-sdl.git] / src / game / renders / opengl / r_common.pas
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}
16 unit r_common;
18 interface
20 uses r_textures;
22 var
23 stdfont: TGLFont;
24 smallfont: TGLFont;
25 menufont: TGLFont;
27 procedure r_Common_Load;
28 procedure r_Common_Free;
30 implementation
32 uses e_log, r_fonts, g_options;
34 function r_Common_LoadFont (const name: AnsiString): TGLFont;
35 var info: TFontInfo; skiphack: Integer;
36 begin
37 result := nil;
38 if name = 'STD' then skiphack := 144 else skiphack := 0;
39 if r_Font_LoadInfoFromFile(GameWad + ':FONTS/' + name + 'TXT', info) then
40 result := r_Textures_LoadFontFromFile(GameWad + ':FONTS/' + name + 'FONT', info, skiphack, true);
41 if result = nil then
42 e_logwritefln('failed to load font %s', [name]);
43 end;
45 procedure r_Common_Load;
46 begin
47 stdfont := r_Common_LoadFont('STD');
48 smallfont := r_Common_LoadFont('SMALL');
49 menufont := r_Common_LoadFont('MENU');
50 end;
52 procedure r_Common_Free;
53 begin
54 menufont.Free;
55 smallfont.Free;
56 stdfont.Free;
57 end;
59 end.