Simple area with text.



Font font()
Font font(Font font_)

Sets text size.

string text()
string text(string text_)

Sets displayed text.

RGBA textColor()
RGBA textColor(RGBA textColor_)

Sets diffuse color of displayed text.

float textSize()
float textSize(float textSize_)

Sets size of displayed text.


Font _font;

The font used for text.

float _letterSpacing;

Additional space between letters, in pixels.

string _text;

Text to draw

RGBA _textColor;

Diffuse color of displayed text.

float _textSize;

Size of displayed text in pixels.

bool clickable;

Sets to true if this is clickable

Inherited Members

From UIElement

void renderRaw(ImageRef!RGBA rawMap, in box2i[] areasToUpdate)

This method is called for each item in the drawlist that was visible and has a dirty Raw layer. This is called after compositing, starting from the buffer output by the Compositor.

void renderPBR(ImageRef!RGBA diffuseMap, ImageRef!L16 depthMap, ImageRef!RGBA materialMap, in box2i[] areasToUpdate)
void reflow(box2i availableSpace)

TODO: useless until we have resizeable UIs. Meant to be overriden almost everytime for custom behaviour. Default behaviour is to span the whole area and reflow children. Any layout algorithm is up to you. Like in the DOM, children elements don't need to be inside _position of their parent.

box2i position()
box2i position(box2i p)

Forces the position of the element. It is typically used in the parent reflow() method IMPORTANT: As of today you are not allowed to assign a position outside the extent of

void removeChild(UIElement element)

Removes a child (but does not destroy it, you take back the ownership of it). Useful for creating dynamic UI's. MAYDO: there are restrictions for where this is allowed. Find them.

void setDirtyWhole(UILayer layer = UILayer.guessFromFlags)

Mark this element as wholly dirty.

void setDirty(box2i rect, UILayer layer = UILayer.guessFromFlags)

Mark a part of the element dirty. This part must be a subrect of its _position.

UIElement parent()
UIElement topLevelParent()
void getDrawLists(ref Vec!UIElement listRaw, ref Vec!UIElement listPBR)

Appends the Elements that should be drawn, in order. You should empty it before calling this function. Everything visible get into the draw list, but that doesn't mean they will get drawn if they don't overlap with a dirty area.

void onDrawRaw(ImageRef!RGBA rawMap, box2i[] dirtyRects)

Raw layer draw method. This gives you 1 surface cropped by _position for drawing. Note that you are not forced to draw all to the surfacs at all.

void onDrawPBR(ImageRef!RGBA diffuseMap, ImageRef!L16 depthMap, ImageRef!RGBA materialMap, box2i[] dirtyRects)

PBR layer draw method. This gives you 3 surfaces cropped by _position for drawing. Note that you are not forced to draw all to the surfaces at all, in which case the below UIElement will be displayed.

void onAnimate(double dt, double time)

Called periodically for every UIElement. Override this to create animations. Using setDirty there allows to redraw an element continuously (like a meter or an animated object). Warning: Summing dt will not lead to a time that increase like time. time can go backwards if the window was reopen. time is guaranteed to increase as fast as system time but is not synced to audio time.

UIElement _parent;

Parent element. Following this chain gets to the root element.

box2i _position;

Position is the graphical extent of the element, or something larger. An UIElement is not allowed though to draw further than its _position. For efficiency it's best to keep _position as small as feasible.

Vec!UIElement _children;

The list of children UI elements.

bool _visible;

If _visible is false, neither the Element nor its children are drawn.

immutable(uint) _flags;

Flags, for now immutable

int _zOrder;

Higher z-order = above other UIElement. By default, every UIElement have the same z-order. Because the sort is stable, tree traversal order is the default order (depth first).