Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Campaigns menu overhaul #5358

Merged
merged 8 commits into from Dec 19, 2020
10 changes: 0 additions & 10 deletions data/advanced_preferences.cfg
Expand Up @@ -167,15 +167,5 @@
default=no
[/advanced_preference]

[advanced_preference]
field=use_prng
name= _ "Use experimental PRNG combat"
description= _ "Enables more determinstic chance-to-hit calculations. This is an experimental feature designed to bring the observed hit/miss rate more in line with the displayed percentages.

Note: this option only affects singleplayer, and the ‘Save random seed’ option must also be enabled when creating a game for this to work."
type=boolean
default=no
[/advanced_preference]

#ifdef __UNUSED__
#endif
73 changes: 73 additions & 0 deletions data/gui/widget/panel_campaign_menu.cfg
@@ -0,0 +1,73 @@
#textdomain wesnoth-lib
###
### Panel with a configurable background (via label text) for the Campaigns menu.
###

#define _GUI_RESOLUTION RESOLUTION BORDER
[resolution]

{RESOLUTION}

left_border = {BORDER}
right_border = {BORDER}
top_border = {BORDER}
bottom_border = {BORDER}

[background]

[draw]

[image]
name = "(if(text = '', 'story/landscape-battlefield_nohumans.jpg', text) .. '~O(0.25)')"
x = "(max(0, (width - (width / (image_original_width/image_original_height))) / 2))"
w = "(width / (image_original_width/image_original_height))"
h = "(height * (image_original_width/image_original_height))"
[/image]

[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"

border_thickness = 3
border_color = "16, 22, 35, 255"

fill_color = {GUI__BACKGROUND_COLOR_ENABLED ALPHA=138}
[/rectangle]

[rectangle]
x = 1
y = 1
w = "(width - 2)"
h = "(height - 2)"

border_thickness = 1
border_color = {GUI__BORDER_COLOR_DARK}
[/rectangle]

[/draw]

[/background]

[foreground]

[draw]

[/draw]

[/foreground]

[/resolution]
#enddef

[panel_definition]

id = "campaign_menu_bg"
description = "Definition of the dynamic background panel for the Campaigns menu"

{_GUI_RESOLUTION () 3}

[/panel_definition]

#undef _GUI_RESOLUTION
39 changes: 39 additions & 0 deletions data/gui/widget/panel_listbox_bg.cfg
@@ -0,0 +1,39 @@
#textdomain wesnoth-lib
###
### Panel with identical background to a default toggle_panel.
###

[panel_definition]

id = "panel_listbox_bg"
description = "Panel with identical background to a default toggle_panel."

[resolution]

[background]

[draw]

[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
fill_color = {GUI__BACKGROUND_COLOR_ENABLED}
[/rectangle]

[/draw]

[/background]

[foreground]

[draw]

[/draw]

[/foreground]

[/resolution]

[/panel_definition]
34 changes: 23 additions & 11 deletions data/gui/widget/toggle_button_listbox_header.cfg
Expand Up @@ -4,9 +4,9 @@
### Since for this class 'default' is a bit hard we now use the checkbox as default.
###

#define _GUI_TEXT FONT_SIZE FONT_COLOR
#define _GUI_TEXT HORIZONTAL_POSITION FONT_SIZE FONT_COLOR
[text]
x = 5
x = {HORIZONTAL_POSITION}
y = {GUI__TEXT_VERTICALLY_CENTRED}
w = "(width)"
h = "(text_height)"
Expand All @@ -17,6 +17,9 @@
#enddef

#define _GUI_RESOLUTION RESOLUTION WIDTH HEIGHT FONT_SIZE
#arg HORIZONTAL_POSITION
5 #endarg

[resolution]

{RESOLUTION}
Expand All @@ -38,7 +41,7 @@

[draw]

{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }

[/draw]

Expand All @@ -48,7 +51,7 @@

[draw]

{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) }

[/draw]

Expand All @@ -66,7 +69,7 @@
fill_color = "255, 255, 255, 76"
[/rectangle]

{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }

[/draw]

Expand All @@ -90,7 +93,7 @@
fill_color = "255, 255, 255, 25"
[/rectangle]

{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }

[image]
x = "(width - 15)"
Expand All @@ -104,7 +107,7 @@
[disabled]

[draw]
{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) }

[image]
x = "(width - 15)"
Expand All @@ -128,7 +131,7 @@
fill_color = "255, 255, 255, 76"
[/rectangle]

{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }

[image]
x = "(width - 15)"
Expand Down Expand Up @@ -157,7 +160,7 @@
fill_color = "255, 255, 255, 25"
[/rectangle]

{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }

[image]
x = "(width - 15)"
Expand All @@ -171,7 +174,7 @@
[disabled]

[draw]
{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) }

[image]
x = "(width - 15)"
Expand All @@ -195,7 +198,7 @@
fill_color = "255, 255, 255, 76"
[/rectangle]

{_GUI_TEXT ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }
{_GUI_TEXT ({HORIZONTAL_POSITION}) ({FONT_SIZE}) ({GUI__FONT_COLOR_ENABLED__TITLE}) }

[image]
x = "(width - 15)"
Expand All @@ -220,5 +223,14 @@

[/toggle_button_definition]

[toggle_button_definition]

id = "listbox_header_centered"
description = "Checkbox, centered."

{_GUI_RESOLUTION () 30 20 ({GUI_FONT_SIZE_SMALL}) HORIZONTAL_POSITION={GUI__TEXT_HORIZONTALLY_CENTRED}}

[/toggle_button_definition]

#undef _GUI_TEXT
#undef _GUI_RESOLUTION