Client: Added Font_LoadFont() as a wrapper for loadfont(), which will
parse definitions located in the filesystem instead of hardcoding font paths and sizes.
This commit is contained in:
parent
75f97827dc
commit
e42b714458
|
@ -0,0 +1,3 @@
|
||||||
|
name "16"
|
||||||
|
font "gfx/shell/arial"
|
||||||
|
size "16"
|
|
@ -0,0 +1,3 @@
|
||||||
|
name "cr"
|
||||||
|
font "gfx/shell/arial"
|
||||||
|
size "20"
|
|
@ -0,0 +1,3 @@
|
||||||
|
name "font"
|
||||||
|
font "gfx/shell/arial"
|
||||||
|
size "12"
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -113,9 +113,9 @@ void
|
||||||
CSQC_RendererRestarted(string rstr)
|
CSQC_RendererRestarted(string rstr)
|
||||||
{
|
{
|
||||||
/* Fonts */
|
/* Fonts */
|
||||||
FONT_16 = loadfont("16", "fonts/default", "16", -1);
|
FONT_16 = Font_LoadFont("fonts/font16.font");
|
||||||
FONT_20 = loadfont("cr", "creditsfont?fmt=h", "20", -1);
|
FONT_20 = Font_LoadFont("fonts/font20.font");
|
||||||
FONT_CON = loadfont("font", "", "12", -1);
|
FONT_CON = Font_LoadFont("fonts/fontcon.font");
|
||||||
drawfont = FONT_CON;
|
drawfont = FONT_CON;
|
||||||
|
|
||||||
/* Particles */
|
/* Particles */
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* very basic wrapper around loadfont(), as we don't want to hard-code
|
||||||
|
* paths to fonts used in the cgame */
|
||||||
|
float
|
||||||
|
Font_LoadFont(string filename)
|
||||||
|
{
|
||||||
|
string line;
|
||||||
|
filestream fs_font;
|
||||||
|
|
||||||
|
fs_font = fopen(filename, FILE_READ);
|
||||||
|
|
||||||
|
if (fs_font < 0) {
|
||||||
|
print(sprintf("[FONT] ^1WARNING: ^7Could NOT load %s\n", filename));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
string font;
|
||||||
|
string size;
|
||||||
|
string shortname;
|
||||||
|
while ((line = fgets(fs_font))) {
|
||||||
|
int c = tokenize_console(line);
|
||||||
|
|
||||||
|
switch (argv(0)) {
|
||||||
|
case "font":
|
||||||
|
font = argv(1);
|
||||||
|
break;
|
||||||
|
case "size":
|
||||||
|
size = argv(1);
|
||||||
|
break;
|
||||||
|
case "name":
|
||||||
|
shortname = argv(1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fs_font);
|
||||||
|
|
||||||
|
return loadfont(shortname, font, size, -1);
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
#includelist
|
#includelist
|
||||||
fog.qc
|
fog.qc
|
||||||
|
font.qc
|
||||||
sky.qc
|
sky.qc
|
||||||
music.qc
|
music.qc
|
||||||
sound.qc
|
sound.qc
|
||||||
|
|
|
@ -106,7 +106,7 @@ m_init(void)
|
||||||
cvar_set("v_bobup", "0.5");
|
cvar_set("v_bobup", "0.5");
|
||||||
cvar_set("v_contentblend", "0");
|
cvar_set("v_contentblend", "0");
|
||||||
cvar_set("gl_mindist", "4");
|
cvar_set("gl_mindist", "4");
|
||||||
cvar_set("con_textsize", "-12");
|
cvar_set("con_textsize", "12");
|
||||||
cvar_set("scr_conalpha", "1");
|
cvar_set("scr_conalpha", "1");
|
||||||
cvar_set("scr_sshot_type", "tga");
|
cvar_set("scr_sshot_type", "tga");
|
||||||
cvar_set("con_notifylines", "0");
|
cvar_set("con_notifylines", "0");
|
||||||
|
|
Loading…
Reference in New Issue