Buttons: refactored procedural drawing to avid alpha-corner hack

That hacked stopped being a thing in e993e2820b
This commit is contained in:
Charles Dang 2016-09-10 21:44:28 +11:00
parent 6758ef48d3
commit eaf5ef96ed

View file

@ -12,110 +12,69 @@
#define _GUI_BUTTON_FONT_SIZE
16 #enddef
#define _GUI_POINT X Y COLOR
#define _GUI_LINE X1 Y1 X2 Y2 COLOR
[line]
x1 = {X}
y1 = {Y}
x2 = {X}
y2 = {Y}
x1 = {X1}
y1 = {Y1}
x2 = {X2}
y2 = {Y2}
thickness = 1
color = {COLOR}
[/line]
#enddef
#define _GUI_POINT X Y COLOR
{_GUI_LINE {X} {Y} {X} {Y} {COLOR}}
#enddef
#define _GUI_STATE BACKGROUND_IMAGE BORDER_COLOR BORDER_COLOR_DARK HIGHLIGHT_LINE_COLOR IPF
#
# Background
#
[image]
x = 2
y = 2
w = "(width)"
h = "(height)"
name = "buttons/button_normal/{BACKGROUND_IMAGE}.png{IPF}"
[/image]
[rectangle]
x = 0
y = 0
w = "(width)"
h = "(height)"
border_thickness = 3
border_color = "1, 10, 16, 255"
[/rectangle]
[rectangle]
x = 1
y = 0
w = "(width - 1)"
h = "(height - 1)"
border_thickness = 1
border_color = {BORDER_COLOR}
[/rectangle]
#
# Darken borders along the left and bottom
# Dark background borders
#
[line]
x1 = 1
y1 = 1
x2 = 1
y2 = "(height - 2)"
thickness = 1
color = {BORDER_COLOR_DARK}
[/line]
[line]
x1 = 1
y1 = "(height - 2)"
x2 = "(width - 2)"
y2 = "(height - 2)"
thickness = 1
color = {BORDER_COLOR_DARK}
[/line]
{_GUI_LINE 0 1 0 "(height - 2)" "1, 10, 16, 255"}
{_GUI_LINE 2 1 "(width - 2)" 1 "1, 10, 16, 255"}
{_GUI_LINE 1 "(height - 1)" "(width - 2)" "(height - 1)" "1, 10, 16, 255"}
{_GUI_LINE "(width - 2)" 1 "(width - 2)" "(height - 1)" "1, 10, 16, 255"}
#
# Tint lines on the top and right
# Gold colored borders
#
[line]
x1 = 3
y1 = 2
x2 = "(width - 3)"
y2 = 2
{_GUI_LINE 2 0 "(width - 2)" 0 {BORDER_COLOR}}
{_GUI_LINE "(width - 1)" 1 "(width - 1)" "(height - 3)" {BORDER_COLOR}}
thickness = 1
color = {HIGHLIGHT_LINE_COLOR}
[/line]
{_GUI_LINE 1 1 1 "(height - 3)" {BORDER_COLOR_DARK}}
{_GUI_LINE 2 "(height - 2)" "(width - 2)" "(height - 2)" {BORDER_COLOR_DARK}}
[line]
x1 = "(width - 3)"
y1 = 2
x2 = "(width - 3)"
y2 = "(height - 4)"
#
# Blue tint lines on the top and right
#
thickness = 1
color = {HIGHLIGHT_LINE_COLOR}
[/line]
{_GUI_LINE 3 2 "(width - 3)" 2 {HIGHLIGHT_LINE_COLOR}}
{_GUI_LINE "(width - 3)" 2 "(width - 3)" "(height - 4)" {HIGHLIGHT_LINE_COLOR}}
#
# Round the corners
#
{_GUI_POINT 0 0 ("0, 0, 0, 0")}
{_GUI_POINT 1 0 ("0, 0, 0, 0")}
{_GUI_POINT 2 1 {BORDER_COLOR_DARK}}
{_GUI_POINT 0 "(height - 1)" ("0, 0, 0, 0")}
{_GUI_POINT 1 "(height - 2)" ("0, 0, 0, 0")}
{_GUI_POINT 2 "(height - 3)" {BORDER_COLOR_DARK}}
{_GUI_POINT "(width - 1)" 0 ("0, 0, 0, 0")}
{_GUI_POINT "(width - 2)" 1 {BORDER_COLOR}}
{_GUI_POINT "(width - 1)" "(height - 1)" ("0, 0, 0, 0")}
{_GUI_POINT "(width - 1)" "(height - 2)" ("0, 0, 0, 0")}
{_GUI_POINT "(width - 2)" "(height - 3)" {BORDER_COLOR}}
#enddef
@ -227,5 +186,6 @@
#undef _GUI_BORDER_COLOR_ALPHA
#undef _GUI_BORDER_COLOR_DARK_ALPHA
#undef _GUI_POINT
#undef _GUI_LINE
#undef _GUI_STATE
#undef _GUI_RESOLUTION