gui2/button: Add definitions for special title screen buttons
These buttons have an icon like normal action buttons do, but they also keep their text label and use a smaller font. Currently only one instance is provided, for the Language button.
This commit is contained in:
parent
ff3e7c3339
commit
df9f12568e
1 changed files with 136 additions and 0 deletions
136
data/gui/widget/button_title_screen_small.cfg
Normal file
136
data/gui/widget/button_title_screen_small.cfg
Normal file
|
@ -0,0 +1,136 @@
|
|||
#textdomain wesnoth-lib
|
||||
|
||||
#define _GUI_BUTTON_FONT_SIZE
|
||||
{GUI_FONT_SIZE_TINY} #enddef
|
||||
|
||||
#define _GUI_BUTTON_TEXT FONT_SIZE FONT_STYLE FONT_COLOR
|
||||
[text]
|
||||
x = 30 # 10 px padding left + 20 px image width
|
||||
y = "(max((height - text_height - 2) / 2, 0))"
|
||||
w = "(width - 40)" # 10 px padding right
|
||||
h = "(text_height)"
|
||||
maximum_width = "(width - 40)" # 10 px padding right
|
||||
font_size = {FONT_SIZE}
|
||||
font_style = {FONT_STYLE}
|
||||
color = {FONT_COLOR}
|
||||
text = "(text)"
|
||||
text_markup = "(text_markup)"
|
||||
text_alignment = "right"
|
||||
[/text]
|
||||
#enddef
|
||||
|
||||
#define _GUI_BUTTON_ICON IMAGE_FILESTEM IPF
|
||||
[image]
|
||||
x = 5
|
||||
y = "(max(pos, 0) where pos = floor((height - image_height) / 2))"
|
||||
|
||||
w = "(min(width, image_original_width))"
|
||||
h = "(min(height, image_original_height))"
|
||||
|
||||
name = {IMAGE_FILESTEM} + ".png{IPF}"
|
||||
[/image]
|
||||
#enddef
|
||||
|
||||
#define _GUI_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT EXTRA_WIDTH EXTRA_HEIGHT FONT_SIZE ICON IPF ALPHA
|
||||
[resolution]
|
||||
|
||||
{RESOLUTION}
|
||||
|
||||
min_width = {MIN_WIDTH}
|
||||
min_height = {HEIGHT}
|
||||
|
||||
default_width = {DEFAULT_WIDTH}
|
||||
default_height = {HEIGHT}
|
||||
|
||||
max_width = 0
|
||||
max_height = {HEIGHT}
|
||||
|
||||
text_extra_width = {EXTRA_WIDTH}
|
||||
text_extra_height = {EXTRA_HEIGHT}
|
||||
text_font_size = {FONT_SIZE}
|
||||
|
||||
[state_enabled]
|
||||
|
||||
[draw]
|
||||
|
||||
{GUI__BUTTON_NORMAL_FRAME "buttons/button_normal/background"
|
||||
({GUI__BORDER_COLOR ALPHA={ALPHA}})
|
||||
({GUI__BORDER_COLOR_DARK ALPHA={ALPHA}}) ("21, 79, 109, 255") {IPF}}
|
||||
|
||||
{_GUI_BUTTON_ICON {ICON} {IPF}}
|
||||
|
||||
{_GUI_BUTTON_TEXT ({FONT_SIZE}) () ({GUI__FONT_COLOR_ENABLED__TITLE})}
|
||||
|
||||
[/draw]
|
||||
|
||||
[/state_enabled]
|
||||
|
||||
[state_disabled]
|
||||
|
||||
[draw]
|
||||
|
||||
{GUI__BUTTON_NORMAL_FRAME "buttons/button_normal/background"
|
||||
({GUI__FONT_COLOR_DISABLED__DEFAULT ALPHA={ALPHA}})
|
||||
("89, 89, 89, {ALPHA}")
|
||||
("60, 60, 60, 255") "~GS(){IPF}"}
|
||||
|
||||
{_GUI_BUTTON_ICON {ICON} "~GS(){IPF}"}
|
||||
|
||||
{_GUI_BUTTON_TEXT ({FONT_SIZE}) () ({GUI__FONT_COLOR_DISABLED__TITLE})}
|
||||
|
||||
[/draw]
|
||||
|
||||
[/state_disabled]
|
||||
|
||||
[state_pressed]
|
||||
|
||||
[draw]
|
||||
|
||||
{GUI__BUTTON_NORMAL_FRAME "buttons/button_normal/background-pressed"
|
||||
({GUI__BORDER_COLOR ALPHA={ALPHA}})
|
||||
({GUI__BORDER_COLOR_DARK ALPHA={ALPHA}}) ("1, 10, 16, 255") {IPF}}
|
||||
|
||||
{_GUI_BUTTON_ICON {ICON}-pressed {IPF}}
|
||||
|
||||
{_GUI_BUTTON_TEXT ({FONT_SIZE}) () ({GUI__FONT_COLOR_ENABLED__TITLE})}
|
||||
|
||||
[/draw]
|
||||
|
||||
[/state_pressed]
|
||||
|
||||
[state_focused]
|
||||
|
||||
[draw]
|
||||
|
||||
{GUI__BUTTON_NORMAL_FRAME "buttons/button_normal/background-active"
|
||||
({GUI__BORDER_COLOR ALPHA={ALPHA}})
|
||||
({GUI__BORDER_COLOR_DARK ALPHA={ALPHA}}) ("12, 108, 157, 255") {IPF}}
|
||||
|
||||
{_GUI_BUTTON_ICON {ICON}-active {IPF}}
|
||||
|
||||
{_GUI_BUTTON_TEXT ({FONT_SIZE}) () ({GUI__FONT_COLOR_ENABLED__TITLE})}
|
||||
|
||||
[/draw]
|
||||
|
||||
[/state_focused]
|
||||
|
||||
[/resolution]
|
||||
#enddef
|
||||
|
||||
[button_definition]
|
||||
|
||||
id = "titlescreen_language"
|
||||
description = "Language button used on the main menu."
|
||||
|
||||
{_GUI_RESOLUTION () 40 80 16 43 14 ({_GUI_BUTTON_FONT_SIZE}) icons/action/language_25 () 255}
|
||||
{_GUI_RESOLUTION ({GUI_BIG_RESOLUTION})
|
||||
50 80 20 46 16
|
||||
({GUI_SCALE_RESOLUTION {_GUI_BUTTON_FONT_SIZE}})
|
||||
icons/action/language_25 () 255}
|
||||
|
||||
[/button_definition]
|
||||
|
||||
#undef _GUI_RESOLUTION
|
||||
#undef _GUI_BUTTON_ICON
|
||||
#undef _GUI_BUTTON_TEXT
|
||||
#undef _GUI_BUTTON_FONT_SIZE
|
Loading…
Add table
Reference in a new issue