GUI2: made GUI_CENTERED_IMAGE more robust and deployed it for buttons instead of a custom macro

This commit is contained in:
Charles Dang 2017-04-07 12:06:39 +11:00
parent a5b795c57a
commit a0ff2a5e96
2 changed files with 9 additions and 13 deletions

View file

@ -257,8 +257,11 @@
#enddef
#define GUI_CENTERED_IMAGE
x = "(width / 2 - image_width / 2)"
y = "(height / 2 - image_height / 2)"
x = "(max(pos, 0) where pos = floor((width - image_width) / 2))"
y = "(max(pos, 0) where pos = floor((height - image_height) / 2))"
w = "(min(width, image_original_width))"
h = "(min(height, image_original_height))"
#enddef
#define GUI_HORIZONTAL_SPACER_LINE

View file

@ -3,13 +3,6 @@
### Definition of non-standard buttons of varying sizes
###
#define _GUI_OVERLAY_ATTRIBUTES
x = "(width / 2 - min(width, image_width) / 2)"
y = "(height / 2 - min(height, image_height) / 2)"
w = "(min(width, image_width))"
h = "(min(height, image_height))"
#enddef
#define _GUI_RESOLUTION RESOLUTION SIZE IMAGE IMAGE_OVERLAY IPF
[resolution]
@ -35,7 +28,7 @@
[/image]
[image]
{_GUI_OVERLAY_ATTRIBUTES}
{GUI_CENTERED_IMAGE}
name = {IMAGE_OVERLAY} + ".png{IPF}"
[/image]
@ -55,7 +48,7 @@
[/image]
[image]
{_GUI_OVERLAY_ATTRIBUTES}
{GUI_CENTERED_IMAGE}
name = {IMAGE_OVERLAY} + ".png~GS(){IPF}"
[/image]
@ -75,7 +68,7 @@
[/image]
[image]
{_GUI_OVERLAY_ATTRIBUTES}
{GUI_CENTERED_IMAGE}
name = {IMAGE_OVERLAY} + "-pressed.png{IPF}"
[/image]
@ -95,7 +88,7 @@
[/image]
[image]
{_GUI_OVERLAY_ATTRIBUTES}
{GUI_CENTERED_IMAGE}
name = {IMAGE_OVERLAY} + "-active.png{IPF}"
[/image]