Menu button fonts are configurable
This commit is contained in:
parent
39447c977e
commit
6d30a52855
3 changed files with 28 additions and 19 deletions
src
|
@ -270,6 +270,7 @@ typedef struct _ui_ {
|
|||
int X; /// button screen X position
|
||||
int Y; /// button screen Y position
|
||||
char* Text; /// button caption
|
||||
int Font; /// button caption font
|
||||
int Width; /// button width
|
||||
int Height; /// button height
|
||||
int Button; /// button style
|
||||
|
|
|
@ -256,10 +256,6 @@ global void DoScrollArea(enum _scroll_state_ state, int fast)
|
|||
|
||||
/**
|
||||
** Draw menu button area.
|
||||
**
|
||||
** With debug it shows the used frame time and arrival of network packets.
|
||||
**
|
||||
** @todo Must be more configurable. Adding diplomacy menu here?
|
||||
*/
|
||||
local void DrawMenuButtonArea(void)
|
||||
{
|
||||
|
@ -271,35 +267,35 @@ local void DrawMenuButtonArea(void)
|
|||
}
|
||||
if (!IsNetworkGame()) {
|
||||
if (TheUI.MenuButton.X != -1) {
|
||||
//FIX ME: Transparent flag, 3rd param, has been hardcoded.
|
||||
// FIXME: Transparent flag, 3rd param, has been hardcoded.
|
||||
DrawMenuButton(TheUI.MenuButton.Button,
|
||||
(ButtonAreaUnderCursor == ButtonAreaMenu
|
||||
&& ButtonUnderCursor == ButtonUnderMenu ? MenuButtonActive : 0) |
|
||||
(GameMenuButtonClicked ? MenuButtonClicked : 0), /*Transparent */ 0,
|
||||
(ButtonAreaUnderCursor == ButtonAreaMenu &&
|
||||
ButtonUnderCursor == ButtonUnderMenu ? MenuButtonActive : 0) |
|
||||
(GameMenuButtonClicked ? MenuButtonClicked : 0), /* Transparent */ 0,
|
||||
TheUI.MenuButton.Width, TheUI.MenuButton.Height,
|
||||
TheUI.MenuButton.X, TheUI.MenuButton.Y,
|
||||
GameFont, TheUI.MenuButton.Text, NULL, NULL);
|
||||
TheUI.MenuButton.Font, TheUI.MenuButton.Text, NULL, NULL);
|
||||
}
|
||||
} else {
|
||||
if (TheUI.NetworkMenuButton.X != -1) {
|
||||
//FIX ME: Transparent flag, 3rd param, has been hardcoded.
|
||||
// FIXME: Transparent flag, 3rd param, has been hardcoded.
|
||||
DrawMenuButton(TheUI.NetworkMenuButton.Button,
|
||||
(ButtonAreaUnderCursor == ButtonAreaMenu
|
||||
&& ButtonUnderCursor == ButtonUnderNetworkMenu ? MenuButtonActive : 0) |
|
||||
(GameMenuButtonClicked ? MenuButtonClicked : 0), /*Transparent */ 0,
|
||||
(ButtonAreaUnderCursor == ButtonAreaMenu &&
|
||||
ButtonUnderCursor == ButtonUnderNetworkMenu ? MenuButtonActive : 0) |
|
||||
(GameMenuButtonClicked ? MenuButtonClicked : 0), /* Transparent */ 0,
|
||||
TheUI.NetworkMenuButton.Width, TheUI.NetworkMenuButton.Height,
|
||||
TheUI.NetworkMenuButton.X, TheUI.NetworkMenuButton.Y,
|
||||
GameFont, TheUI.NetworkMenuButton.Text, NULL, NULL);
|
||||
TheUI.NetworkMenuButton.Font, TheUI.NetworkMenuButton.Text, NULL, NULL);
|
||||
}
|
||||
if (TheUI.NetworkDiplomacyButton.X != -1) {
|
||||
//FIX ME: Transparent flag, 3rd param, has been hardcoded.
|
||||
// FIXME: Transparent flag, 3rd param, has been hardcoded.
|
||||
DrawMenuButton(TheUI.NetworkDiplomacyButton.Button,
|
||||
(ButtonAreaUnderCursor == ButtonAreaMenu
|
||||
&& ButtonUnderCursor == ButtonUnderNetworkDiplomacy ? MenuButtonActive : 0) |
|
||||
(GameDiplomacyButtonClicked ? MenuButtonClicked : 0), /*Transparent */ 0,
|
||||
(ButtonAreaUnderCursor == ButtonAreaMenu &&
|
||||
ButtonUnderCursor == ButtonUnderNetworkDiplomacy ? MenuButtonActive : 0) |
|
||||
(GameDiplomacyButtonClicked ? MenuButtonClicked : 0), /* Transparent */ 0,
|
||||
TheUI.NetworkDiplomacyButton.Width, TheUI.NetworkDiplomacyButton.Height,
|
||||
TheUI.NetworkDiplomacyButton.X, TheUI.NetworkDiplomacyButton.Y,
|
||||
GameFont, TheUI.NetworkDiplomacyButton.Text, NULL, NULL);
|
||||
TheUI.NetworkDiplomacyButton.Font, TheUI.NetworkDiplomacyButton.Text, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1681,6 +1681,10 @@ local int CclDefineUI(lua_State* l)
|
|||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->MenuButton.Text = strdup(LuaToString(l, -1));
|
||||
lua_pop(l, 1);
|
||||
} else if (!strcmp(value, "font")) {
|
||||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->MenuButton.Font = FontByIdent(LuaToString(l, -1));
|
||||
lua_pop(l, 1);
|
||||
} else if (!strcmp(value, "style")) {
|
||||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->MenuButton.Button = scm2buttonid(l, LuaToString(l, -1));
|
||||
|
@ -1728,6 +1732,10 @@ local int CclDefineUI(lua_State* l)
|
|||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->NetworkMenuButton.Text = strdup(LuaToString(l, -1));
|
||||
lua_pop(l, 1);
|
||||
} else if (!strcmp(value, "font")) {
|
||||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->NetworkMenuButton.Font = FontByIdent(LuaToString(l, -1));
|
||||
lua_pop(l, 1);
|
||||
} else if (!strcmp(value, "style")) {
|
||||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->NetworkMenuButton.Button = scm2buttonid(l, LuaToString(l, -1));
|
||||
|
@ -1775,6 +1783,10 @@ local int CclDefineUI(lua_State* l)
|
|||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->NetworkDiplomacyButton.Text = strdup(LuaToString(l, -1));
|
||||
lua_pop(l, 1);
|
||||
} else if (!strcmp(value, "font")) {
|
||||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->NetworkDiplomacyButton.Font = FontByIdent(LuaToString(l, -1));
|
||||
lua_pop(l, 1);
|
||||
} else if (!strcmp(value, "style")) {
|
||||
lua_rawgeti(l, -1, subk + 1);
|
||||
ui->NetworkDiplomacyButton.Button = scm2buttonid(l, LuaToString(l, -1));
|
||||
|
|
Loading…
Add table
Reference in a new issue