tModLoader v2024.11
A mod to make and play Terraria mods
|
Represents a dimension, either an absolute pixel size, a percentage of the available space, or a combination of both. For example uiElement.Width.Set(200, 0f);
sets an absolute width of 200 pixels. uiElement.Width.Set(0, 0.5f);
on the otherhand sets a width of 50% of the parent's avaiable UIElement.GetInnerDimensions. Both values can be set for more complex logic. uiElement.Width.Set(-10, 0.5f);
sets the width to 50% of the available space minus 10 pixels. This would leave room between 2 buttons filling a space. uiElement.Height.Set(-100, 1f);
would fill the full height of the space but leave 100 pixels at the bottom empty.
More...
Public Member Functions | |
StyleDimension (float pixels, float precent) | |
float | GetValue (float containerSize) |
void | Set (float pixels, float precent) |
Static Public Member Functions | |
static StyleDimension | FromPercent (float percent) |
static StyleDimension | FromPixels (float pixels) |
static StyleDimension | FromPixelsAndPercent (float pixels, float percent) |
Public Attributes | |
float | Pixels |
float | Precent |
Static Public Attributes | |
static StyleDimension | Empty = new StyleDimension(0f, 0f) |
static StyleDimension | Fill = new StyleDimension(0f, 1f) |
Properties | |
float | Percent [get, set] |
Represents a dimension, either an absolute pixel size, a percentage of the available space, or a combination of both.
For example uiElement.Width.Set(200, 0f);
sets an absolute width of 200 pixels. uiElement.Width.Set(0, 0.5f);
on the otherhand sets a width of 50% of the parent's avaiable UIElement.GetInnerDimensions.
Both values can be set for more complex logic. uiElement.Width.Set(-10, 0.5f);
sets the width to 50% of the available space minus 10 pixels. This would leave room between 2 buttons filling a space. uiElement.Height.Set(-100, 1f);
would fill the full height of the space but leave 100 pixels at the bottom empty.