GUIGraphics

class GUIGraphics : UIElement , IGraphics {
nothrow @nogc
ICompositor compositor;
protected nothrow @nogc
UIContext _uiContext;
protected nothrow @nogc
WindowListener _windowListener;
protected nothrow @nogc
IWindow _window;
protected nothrow @nogc
ThreadPool _threadPool;
protected nothrow @nogc
int _askedWidth;
protected nothrow @nogc
int _askedHeight;
protected nothrow @nogc
Mipmap!RGBA _diffuseMap;
protected nothrow @nogc
Mipmap!L16 _depthMap;
protected nothrow @nogc
Mipmap!RGBA _materialMap;
protected nothrow @nogc
Vec!box2i _areasToUpdateNonOverlapping;
protected nothrow @nogc
Vec!box2i _areasToUpdateTemp;
protected nothrow @nogc
Vec!box2i[2] _updateRectScratch;
protected nothrow @nogc
Vec!box2i _areasToRender;
protected nothrow @nogc
Vec!box2i _areasToRenderNonOverlapping;
protected nothrow @nogc
Vec!box2i _areasToRenderNonOverlappingTiled;
protected nothrow @nogc
Vec!UIElement _elemsToDraw;
protected nothrow @nogc
ubyte* _renderedBuffer;
version(BenchmarkCompositing)
protected nothrow @nogc
StopWatch _compositingWatch;
version(BenchmarkCompositing)
protected nothrow @nogc
StopWatch _mipmapWatch;
version(BenchmarkCompositing)
protected nothrow @nogc
StopWatch _drawWatch;
}

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Classes

WindowListener
class WindowListener

Functions

compositeGUI
void compositeGUI(ImageRef!RGBA wfb, WindowPixelFormat pf)

Compose lighting effects from depth and diffuse into a result. takes output image and non-overlapping areas as input Useful multithreading code.

regenerateMipmaps
void regenerateMipmaps()

Compose lighting effects from depth and diffuse into a result. takes output image and non-overlapping areas as input Useful multithreading code.

renderElements
void renderElements()

Redraw UIElements

setUpdateMargin
void setUpdateMargin(int margin)

Tune this to tune the trade-off between light quality and speed. The default value was tuned by hand on very shiny light sources. Too high and processing becomes very expensive. Too little and the ligth decay doesn't feel natural.

Variables

_updateMargin
int _updateMargin;

Amount of pixels dirty rectangles are extended with.

Inherited Members

From UIElement

render
void render(ImageRef!RGBA diffuseMap, ImageRef!L16 depthMap, ImageRef!RGBA materialMap, box2i[] areasToUpdate)
reflow
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.

position
box2i position()
position
box2i position(box2i p)

Forces the position of the element. It is typically used in the parent reflow() method

removeChild
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.

setDirtyWhole
void setDirtyWhole()

Mark this element as wholly dirty. Important: you could call this from the audio thread, however it is much more efficient to mark the widget dirty with an atomic and call setDirty in animation callback.

setDirty
void setDirty(box2i rect)

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

parent
UIElement parent()
topLevelParent
UIElement topLevelParent()
getDrawList
void getDrawList(Vec!UIElement list)

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.

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

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

onAnimate
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.

_parent
UIElement _parent;

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

_position
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.

_children
Vec!UIElement _children;

The list of children UI elements.

_visible
bool _visible;

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

_zOrder
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).

From IGraphics

openUI
void* openUI(void* parentInfo, void* controlInfo, DAW daw, GraphicsBackend backend)

Create an UI, return a system-specific handle for the window/view

Meta