gui2/ttext_box: Add a 'transparent' backgroundless variant for WML [message]
This commit is contained in:
parent
f28e74c0bd
commit
a9298e1d6d
2 changed files with 35 additions and 25 deletions
|
@ -3,21 +3,6 @@
|
|||
### Definition of a single line text box.
|
||||
###
|
||||
|
||||
#
|
||||
# Text antialiasing doesn't work as expected when rendering over a rectangle
|
||||
# filled with an alpha < 255 color, so instead of using
|
||||
# GUI__BACKGROUND_COLOR_ENABLED and GUI__BACKGROUND_COLOR_DISABLED for the
|
||||
# textbox background, use a fully opaque color that corresponds to the averages
|
||||
# one would get with those two macros.
|
||||
#
|
||||
#define _GUI_TEXTBOX_BACKGROUND_COLOR_ENABLED
|
||||
"10, 13, 22, 255"
|
||||
#enddef
|
||||
|
||||
#define _GUI_TEXTBOX_BACKGROUND_COLOR_DISABLED
|
||||
"28, 31, 41, 255"
|
||||
#enddef
|
||||
|
||||
#define _GUI_DRAW_BACKGROUND COLOR
|
||||
[rectangle]
|
||||
x = 0
|
||||
|
@ -30,6 +15,21 @@
|
|||
[/rectangle]
|
||||
#enddef
|
||||
|
||||
#
|
||||
# Text antialiasing doesn't work as expected when rendering over a rectangle
|
||||
# filled with an alpha < 255 color, so instead of using
|
||||
# GUI__BACKGROUND_COLOR_ENABLED and GUI__BACKGROUND_COLOR_DISABLED for the
|
||||
# textbox background, use fully opaque colors that correspond to the averages
|
||||
# one would get with those two macros.
|
||||
#
|
||||
#define _GUI_TEXTBOX_BACKGROUND_ENABLED
|
||||
{_GUI_DRAW_BACKGROUND ("10, 13, 22, 255")}
|
||||
#enddef
|
||||
|
||||
#define _GUI_TEXTBOX_BACKGROUND_DISABLED
|
||||
{_GUI_DRAW_BACKGROUND ("28, 31, 41, 255")}
|
||||
#enddef
|
||||
|
||||
#define _GUI_DRAW_BORDER COLOR
|
||||
[rectangle]
|
||||
x = 0
|
||||
|
@ -89,7 +89,7 @@
|
|||
[/line]
|
||||
#enddef
|
||||
|
||||
#define _GUI_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT X_OFFSET EXTRA_WIDTH FONT_SIZE
|
||||
#define _GUI_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT X_OFFSET EXTRA_WIDTH FONT_SIZE BACKGROUND_ENABLED BACKGROUND_DISABLED
|
||||
[resolution]
|
||||
|
||||
{RESOLUTION}
|
||||
|
@ -112,7 +112,7 @@
|
|||
|
||||
[draw]
|
||||
|
||||
{_GUI_DRAW_BACKGROUND ({_GUI_TEXTBOX_BACKGROUND_COLOR_ENABLED})}
|
||||
{BACKGROUND_ENABLED}
|
||||
|
||||
{_GUI_DRAW_BORDER ({GUI__FONT_COLOR_ENABLED__TITLE}) }
|
||||
|
||||
|
@ -126,7 +126,7 @@
|
|||
|
||||
[draw]
|
||||
|
||||
{_GUI_DRAW_BACKGROUND ({_GUI_TEXTBOX_BACKGROUND_COLOR_DISABLED})}
|
||||
{BACKGROUND_DISABLED}
|
||||
|
||||
{_GUI_DRAW_BORDER ({GUI__FONT_COLOR_DISABLED__TITLE}) }
|
||||
|
||||
|
@ -140,7 +140,7 @@
|
|||
|
||||
[draw]
|
||||
|
||||
{_GUI_DRAW_BACKGROUND ({_GUI_TEXTBOX_BACKGROUND_COLOR_ENABLED})}
|
||||
{BACKGROUND_ENABLED}
|
||||
|
||||
{_GUI_DRAW_BORDER ({GUI__FONT_COLOR_ENABLED__TITLE}) }
|
||||
|
||||
|
@ -161,8 +161,18 @@
|
|||
description = "Default text box"
|
||||
|
||||
# Tiny gui sizes haven't been tested yet so might need some tuning.
|
||||
{_GUI_RESOLUTION ({GUI_TINY__RESOLUTION}) 20 125 15 5 10 ({GUI_TINY__FONT_SIZE__DEFAULT}) }
|
||||
{_GUI_RESOLUTION () 40 250 25 5 10 ({GUI_NORMAL__FONT_SIZE__DEFAULT}) }
|
||||
{_GUI_RESOLUTION ({GUI_TINY__RESOLUTION}) 20 125 15 5 10 ({GUI_TINY__FONT_SIZE__DEFAULT}) ({_GUI_TEXTBOX_BACKGROUND_ENABLED}) ({_GUI_TEXTBOX_BACKGROUND_DISABLED})}
|
||||
{_GUI_RESOLUTION () 40 250 25 5 10 ({GUI_NORMAL__FONT_SIZE__DEFAULT}) ({_GUI_TEXTBOX_BACKGROUND_ENABLED}) ({_GUI_TEXTBOX_BACKGROUND_DISABLED})}
|
||||
|
||||
[/text_box_definition]
|
||||
|
||||
[text_box_definition]
|
||||
id = "transparent"
|
||||
description = "Background-less text box, used for WML messages"
|
||||
|
||||
# Tiny gui sizes haven't been tested yet so might need some tuning.
|
||||
{_GUI_RESOLUTION ({GUI_TINY__RESOLUTION}) 20 125 15 5 10 ({GUI_TINY__FONT_SIZE__DEFAULT}) () ()}
|
||||
{_GUI_RESOLUTION () 40 250 25 5 10 ({GUI_NORMAL__FONT_SIZE__DEFAULT}) () ()}
|
||||
|
||||
[/text_box_definition]
|
||||
|
||||
|
@ -171,5 +181,5 @@
|
|||
#undef _GUI_DRAW_TEXT
|
||||
#undef _GUI_DRAW_BORDER
|
||||
#undef _GUI_DRAW_BACKGROUND
|
||||
#undef _GUI_TEXTBOX_BACKGROUND_COLOR_ENABLED
|
||||
#undef _GUI_TEXTBOX_BACKGROUND_COLOR_DISABLED
|
||||
#undef _GUI_TEXTBOX_BACKGROUND_ENABLED
|
||||
#undef _GUI_TEXTBOX_BACKGROUND_DISABLED
|
||||
|
|
|
@ -442,7 +442,7 @@
|
|||
|
||||
[text_box]
|
||||
id = "input"
|
||||
definition = "default"
|
||||
definition = "transparent"
|
||||
[/text_box]
|
||||
|
||||
[/column]
|
||||
|
@ -671,7 +671,7 @@ if(gamemap_width - ({__GUI_IMAGE_WIDTH}) > {MAX_TEXT_WIDTH}
|
|||
|
||||
[text_box]
|
||||
id = "input"
|
||||
definition = "default"
|
||||
definition = "transparent"
|
||||
[/text_box]
|
||||
|
||||
[/column]
|
||||
|
|
Loading…
Add table
Reference in a new issue