Menu-FN: Off-load font definitions into external .font files, like cgame
This commit is contained in:
parent
0cd6694c32
commit
844c29bf23
14 changed files with 57 additions and 20 deletions
3
platform/base_scripts.pk3dir/fonts/menu_header.font
Normal file
3
platform/base_scripts.pk3dir/fonts/menu_header.font
Normal file
|
@ -0,0 +1,3 @@
|
|||
name "label_p"
|
||||
font "gfx/shell/arialbd.ttf"
|
||||
size "16 21"
|
3
platform/base_scripts.pk3dir/fonts/menu_label.font
Normal file
3
platform/base_scripts.pk3dir/fonts/menu_label.font
Normal file
|
@ -0,0 +1,3 @@
|
|||
name "label"
|
||||
font "gfx/shell/mssansserif.ttf"
|
||||
size "10 12 14"
|
3
platform/base_scripts.pk3dir/fonts/menu_label_bold.font
Normal file
3
platform/base_scripts.pk3dir/fonts/menu_label_bold.font
Normal file
|
@ -0,0 +1,3 @@
|
|||
name "label_b"
|
||||
font "gfx/shell/arialbd.ttf"
|
||||
size "14 12"
|
3
platform/base_scripts.pk3dir/fonts/menu_main.font
Normal file
3
platform/base_scripts.pk3dir/fonts/menu_main.font
Normal file
|
@ -0,0 +1,3 @@
|
|||
name "label"
|
||||
font "gfx/shell/arial.ttf"
|
||||
size "14 11 12"
|
|
@ -14,7 +14,7 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
string g_bmp[76] = {
|
||||
string g_bmp[77] = {
|
||||
"gfx/shell/btns_main",
|
||||
"gfx/shell/cb_checked",
|
||||
"gfx/shell/cb_disabled",
|
||||
|
@ -90,7 +90,8 @@ string g_bmp[76] = {
|
|||
"gfx/shell/uparrowp",
|
||||
"gfx/shell/up",
|
||||
"gfx/shell/windows",
|
||||
"gfx/shell/won_logo"
|
||||
"gfx/shell/fragnet",
|
||||
"gfx/shell/logo"
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -170,5 +171,6 @@ enum
|
|||
UPARROWP,
|
||||
UP,
|
||||
WINDOWS,
|
||||
WON_LOGO
|
||||
FN_LOGO,
|
||||
LOGO
|
||||
};
|
||||
|
|
|
@ -24,6 +24,11 @@ vector col_refresh_title;
|
|||
vector col_refresh_text;
|
||||
vector col_refresh_bg;
|
||||
|
||||
vector col_button_bg; /* 1,1,1 */
|
||||
vector col_button_select; /* 1,0,0 */
|
||||
vector col_button_click; /* 1,1,0 */
|
||||
vector col_button_disabled; /* 0.25, 0.25, 0.25 */
|
||||
|
||||
string
|
||||
Colors_RGB8_to_HEX(vector color)
|
||||
{
|
||||
|
@ -84,6 +89,11 @@ Colors_Init(void)
|
|||
col_refresh_title = [240,180,24] / 255;
|
||||
col_refresh_text = [255,255,255] / 255;
|
||||
col_refresh_bg = [56,56,56] / 255;
|
||||
|
||||
col_button_bg = [1,1,1];
|
||||
col_button_select = [1,0,0];
|
||||
col_button_click = [1,1,0];
|
||||
col_button_disabled = [0.25, 0.25, 0.25];
|
||||
|
||||
fs_colors = fopen("gfx/shell/colors.lst", FILE_READ);
|
||||
|
||||
|
@ -132,6 +142,18 @@ Colors_Init(void)
|
|||
case "REFRESH_BG_COLOR":
|
||||
col_refresh_bg = coltmp;
|
||||
break;
|
||||
case "BUTTON_BG_COLOR":
|
||||
col_button_bg = coltmp;
|
||||
break;
|
||||
case "BUTTON_SELECT_COLOR":
|
||||
col_button_select = coltmp;
|
||||
break;
|
||||
case "BUTTON_CLICK_COLOR":
|
||||
col_button_click = coltmp;
|
||||
break;
|
||||
case "BUTTON_DISABLED_COLOR":
|
||||
col_button_disabled = coltmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fs_colors);
|
||||
|
|
|
@ -119,22 +119,19 @@ m_init(void)
|
|||
registercommand("menu_musicstart");
|
||||
|
||||
font_console = loadfont("font", "", "12", -1);
|
||||
font_label = loadfont("label", "gfx/shell/mssansserif.ttf", "10 12 14", -1);
|
||||
font_arial = loadfont("label", "gfx/shell/arial.ttf", "14 11 12", -1);
|
||||
font_label_b = loadfont("label_b", "gfx/shell/arialbd.ttf", "14 12", -1);
|
||||
font_label_p = loadfont("label_p", "gfx/shell/arialbd.ttf", "16 21", -1);
|
||||
font_label = Font_LoadFont("fonts/menu_label.font");
|
||||
font_arial = Font_LoadFont("fonts/menu_main.font");
|
||||
font_label_b = Font_LoadFont("fonts/menu_label_bold.font");
|
||||
font_label_p = Font_LoadFont("fonts/menu_header.font");
|
||||
|
||||
localcmd("plug_load ffmpeg\n");
|
||||
|
||||
shaderforname("logo_avi", "{\n{\nvideomap av:media/logo.avi\n}\n}");
|
||||
|
||||
for (int i = 0; i < g_bmp.length; i++) {
|
||||
precache_pic(g_bmp[i]);
|
||||
}
|
||||
|
||||
g_btnsize = drawgetimagesize(g_bmp[BTNS_MAIN]);
|
||||
g_btnofs = 26 / g_btnsize[1];
|
||||
precache_pic("gfx/shell/fragnet");
|
||||
|
||||
games_init();
|
||||
main_init();
|
||||
|
|
|
@ -67,5 +67,7 @@ m_main.qc
|
|||
music.qc
|
||||
menu.qc
|
||||
background.qc
|
||||
|
||||
../client/font.qc
|
||||
entry.qc
|
||||
#endlist
|
||||
|
|
|
@ -400,7 +400,7 @@ menu_chatrooms_draw(void)
|
|||
static float timeout;
|
||||
|
||||
Widget_Draw(fn_chatrooms);
|
||||
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], "gfx/shell/fragnet",[80,80], [1,1,1], 1.0f, 0);
|
||||
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], g_bmp[FN_LOGO],[80,80], [1,1,1], 1.0f, 0);
|
||||
|
||||
if (!g_ircroom.m_iStatus) {
|
||||
cr_makeconnection();
|
||||
|
|
|
@ -133,7 +133,7 @@ menu_chatroomslist_draw(void)
|
|||
{
|
||||
Widget_Draw(fn_chatroomslist);
|
||||
Header_Draw(HEAD_ROOMS);
|
||||
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], "gfx/shell/fragnet",[80,80], [1,1,1], 1.0f, 0);
|
||||
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], g_bmp[FN_LOGO],[80,80], [1,1,1], 1.0f, 0);
|
||||
|
||||
if (crl_iLoading) {
|
||||
cr_dgConnect.Draw();
|
||||
|
|
|
@ -91,7 +91,7 @@ void
|
|||
menu_creategameinet_draw(void)
|
||||
{
|
||||
Header_Draw(HEAD_CREATEGAME);
|
||||
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], "gfx/shell/fragnet",[80,80], [1,1,1], 1.0f, 0);
|
||||
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], g_bmp[FN_LOGO],[80,80], [1,1,1], 1.0f, 0);
|
||||
|
||||
WLabel_Static(216, 143, m_reslbl[IDS_CREATESERVER_NAME], 14, 14, [1,1,1],
|
||||
1.0f, 0, font_arial);
|
||||
|
|
|
@ -286,7 +286,7 @@ menu_internetgames_draw(void)
|
|||
Widget_Draw(fn_inet);
|
||||
resorthostcache();
|
||||
Header_Draw(HEAD_INETGAMES);
|
||||
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], "gfx/shell/fragnet",[80,80], [1,1,1], 1.0f, 0);
|
||||
drawpic([g_menuofs[0]+550,g_menuofs[1]+10], g_bmp[FN_LOGO],[80,80], [1,1,1], 1.0f, 0);
|
||||
|
||||
/* Labels */
|
||||
WLabel_Static(252, 128, m_reslbl[IDS_SERVER_GAMESERVER], 10, 10, [1,1,1],
|
||||
|
|
|
@ -375,10 +375,12 @@ menu_main_draw(void)
|
|||
} else {
|
||||
/* Don't even attempt to display the logo.avi otherwise */
|
||||
if (games[gameinfo_current].steambg == 0 && checkcommand("ffmpeg_videobitrate")) {
|
||||
drawpic([g_menuofs[0],g_menuofs[1] + 70], "logo_avi",
|
||||
drawpic([g_menuofs[0],g_menuofs[1] + 70], g_bmp[LOGO],
|
||||
g_logosize, [1,1,1], 1.0f);
|
||||
g_logosize = gecko_get_texture_extent("logo_avi");
|
||||
g_logosize = gecko_get_texture_extent(g_bmp[LOGO]);
|
||||
}
|
||||
drawpic([g_menuofs[0],g_menuofs[1] + 48], g_bmp[LOGO],
|
||||
[512, 128], [1,1,1], 1.0f);
|
||||
|
||||
Widget_Draw(fn_main);
|
||||
WLabel_Static(235, 216, m_reslbl[IDS_MAIN_NEWGAMEHELP], HELPTXT_SIZE, HELPTXT_SIZE,
|
||||
|
|
|
@ -222,16 +222,16 @@ CMainButton::Draw(void)
|
|||
} else {
|
||||
drawfont = font_label_p;
|
||||
if (!m_execute) {
|
||||
drawstring([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_mainbtn_text[m_bitmap], [16,16], [0.25,0.25,0.25], 1.0, 0);
|
||||
drawstring([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_mainbtn_text[m_bitmap], [16,16], col_button_disabled, 1.0, 0);
|
||||
return;
|
||||
}
|
||||
if (m_click) {
|
||||
drawstring([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_mainbtn_text[m_bitmap], [16,16], [1,1,0], 1.0, 0);
|
||||
drawstring([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_mainbtn_text[m_bitmap], [16,16], col_button_click, 1.0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
drawstring([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_mainbtn_text[m_bitmap], [16,16], [1,1,1], 1.0, 0);
|
||||
drawstring([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_mainbtn_text[m_bitmap], [16,16], [1,0,0], 1 - m_alpha, 0);
|
||||
drawstring([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_mainbtn_text[m_bitmap], [16,16], col_button_bg, 1.0, 0);
|
||||
drawstring([g_menuofs[0]+m_x,g_menuofs[1]+m_y], g_mainbtn_text[m_bitmap], [16,16], col_button_select, 1 - m_alpha, 0);
|
||||
}
|
||||
|
||||
if (m_hover) {
|
||||
|
|
Loading…
Reference in a new issue