Skip to content

Commit

Permalink
gui2: cleanup of the text box widget design
Browse files Browse the repository at this point in the history
This reduces border size as well as removes a hack related to transparent
backgrounds and text rendering. I can't observe any issue with text AA
using semi-transparent backgrounds anymore.
  • Loading branch information
Vultraz committed Feb 22, 2016
1 parent 710b1fc commit 67cf95a
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions data/gui/default/widget/text_box_default.cfg
Expand Up @@ -15,19 +15,12 @@
[/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")}
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_ENABLED})}
#enddef

#define _GUI_TEXTBOX_BACKGROUND_DISABLED
{_GUI_DRAW_BACKGROUND ("28, 31, 41, 255")}
{_GUI_DRAW_BACKGROUND ({GUI__BACKGROUND_COLOR_DISABLED})}
#enddef

#define _GUI_DRAW_BORDER COLOR
Expand All @@ -37,35 +30,13 @@
w = "(width)"
h = "(height)"

border_thickness = 3
border_color = "55, 55, 55, 192"

[/rectangle]

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

border_thickness = 1
border_color = {COLOR}

[/rectangle]
#enddef

#define _GUI_DRAW_TEXT SIZE COLOR
[rectangle]
x = "(text_x_offset + selection_offset)"
y = "(text_y_offset)"
w = "(selection_width)"
h = "(text_font_height)"

border_thickness = 0
fill_color = "21, 53, 80, 255"

[/rectangle]

[text]
x = "(text_x_offset)"
y = "(text_y_offset)"
Expand Down

0 comments on commit 67cf95a

Please sign in to comment.