FrameworkZ 10.8.3
Provides a framework for Project Zomboid with various systems.
Loading...
Searching...
No Matches
_UI_Helper.lua
Go to the documentation of this file.
2FrameworkZ.UI = {}
3
4--! \brief Get the x position to center text based on the text's width and what you're centering relative to.
5--! \param \int length The length of the object you're centering the text in.
6--! \param \string fontSize The font size of the text (could be UIFont.Small, UIFont.Medium, UIFont.Large, or UIFont.Title).
7--! \param \string text The text you're centering.
8function FrameworkZ.UI.GetCenteredX(length, fontSize, text)
9 local width = getTextManager():MeasureStringX(fontSize, text)
11 return (length / 2) - (width / 2)
12end
13
14function FrameworkZ.UI.GetMiddle(length, fontSize, text)
15 local width = getTextManager():MeasureStringX(fontSize, text)
16
17 return (length - width) / 2
18end
19
20function FrameworkZ.UI.GetHeight(fontSize, text)
21 local height = getTextManager():MeasureStringY(fontSize, text)
22
23 return height
24end
void local x()
void local height()
void local width
void local position()
void local getTextManager()
void FrameworkZ()
Contains all of the User Interfaces for FrameworkZ.
void GetMiddle(length, fontSize, text)
void GetHeight(fontSize, text)
void GetCenteredX(length, fontSize, text)
Get the x position to center text based on the text's width and what you're centering relative to.