Box Styles
By default, boxes start out completely unstyled. You must set every property directly.
UIStyle
See PBUIStyle for a complete description of the structs fields.
Box Sizing
The following sizing modes are available to size boxes:
UISizeKind_Pixels // size by pixels
UISizeKind_TextContent // size of text content
UISizeKind_PercentOfParent // size as a percentage of the parent
UISizeKind_ChildrenSum // size according to the total sum of the children
UISizeKind_Ratio // size proportional to the size on the alternate axis
For convenience, the following macros are also defined. These are the preferred way of defining size attributes.
Box Text
struct UIFont {
PBStrSlice family; // font family name (e.g. PBStrLit("Inter"))
f32 size; // font size in pixels (e.g. 16.0)
f32 weight; // font weight between 100-900
};
UIFont UIFontMake(PBStrSlice family, f32 size, f32 weight);
typedef u32 UITextAlign;
enum {
UITextAlign_None,
UITextAlign_TopLeft,
UITextAlign_TopCenter,
UITextAlign_TopRight,
UITextAlign_CenterLeft,
UITextAlign_Center,
UITextAlign_CenterRight,
UITextAlign_BottomLeft,
UITextAlign_BottomCenter,
UITextAlign_BottomRight,
UITextAlign_COUNT,
};
typedef u32 UITextWrap;
enum {
UITextWrap_None,
UITextWrap_Word,
UITextWrap_COUNT,
};
Color
Shadows
struct UIShadow {
PBVector2 offset; // in pixels
f32 blur; // blur radius, in pixels
f32 spread; // spread radius, in pixels
PBColor color;
bool inset; // whether the shadow should be inset or outset
};
UIShadow UIShadowMake(PBVector2 offset, f32 blur, f32 spread, PBColor color, bool inset);