Simpler and safer GUI2 text positioning formulas
This commit is contained in:
parent
95ab7971f8
commit
1cfad2404f
1 changed files with 2 additions and 2 deletions
|
@ -21,7 +21,7 @@
|
|||
# If the text is too wide it returns the left side.
|
||||
# Rounding happens to the left side.
|
||||
#define GUI__TEXT_HORIZONTALLY_CENTRED
|
||||
"(if(text_width < width, (width - text_width ) / 2, 0))"
|
||||
"(max((width - text_width) / 2, 0))"
|
||||
#enddef
|
||||
|
||||
# Centers the text vertically.
|
||||
|
@ -29,7 +29,7 @@
|
|||
# If the text is too high it returns the top side.
|
||||
# Rounding happens to the bottom side.
|
||||
#define GUI__TEXT_VERTICALLY_CENTRED
|
||||
"(if(text_height < height, (height - text_height - 2) / 2, 0))"
|
||||
"(max((height - text_height - 2) / 2, 0))"
|
||||
#enddef
|
||||
|
||||
#define GUI__CENTERED_TEXT FONT_SIZE FONT_STYLE FONT_COLOR
|
||||
|
|
Loading…
Add table
Reference in a new issue