-
Notifications
You must be signed in to change notification settings - Fork 33
GUI Components
GUI Elements are constructed from a stack of GUI Components that implement the GuiComponent interface. The stacks are composed in a way where each layer acts as a kind of 'decorator' for the next layer (from bottom up).
For example, a Button is built from several different possible layers and the application can change any of these layers.
Therefore, to understand how to tweak a GUI element to get a specific look, it is necessary to understand the GUI components that Lemur provides. Or to know how to write your own.
This component renders a simple colored or textured 2D quad that shrinks/expands with the GUI element. (The texture is stretched directly without any special processing. For a texture that stretches only part and leaves the borders a common scale, see: TbtQuadBackgroundComponent)
The quad is currently always rendered in the x/y plane.
QuadBackgroundComponent can create either a lit or an unlit quad depending on the options specified when created. There is currently no way to change this option once the component has been created.
Properties:
- color: the color of the quad. If there is a texture then this will be combined with the texture.
- alpha: the overall alpha of the quad. This is multiplied by whatever alpha is in the color value.
- texture: an optional texture for the quad.
- margin: a margin that controls how much size the next component in the stack gets. For example, a GUI element that is size 100x100 and has a QuadBackgroundComponent for its 'border' layer and a 5,5 margin would render the 'background' layer at 90x90 with a 5,5 x/y offset.
- zOffset: the z-size of the quad. Useful when layering to create slight stand-offs for subsequent layers.
This is similar to QuadBackgroundComponent except that it always has a texture and it implements 9-patch style stretching.
Why it's called a 'nine patch'.
Lemur calls it a TBT Quad with is short for 'three-by-three' and is shorter to type than 'NinePatchQuadBackgroundComponent' and more unique than NpQuadBackgroundComponent would be. A rose by any other name...
Nine patches are useful for UI Element backgrounds because they provide smarter stretching at the borders.