@NonnullDefault
Package org.lwjgl.util.yoga
Contains bindings to Yoga.
Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API familiar to many designers and opening it up to developers across different platforms.
- Do you already know Flexbox? Then you already know Yoga.
- Write code in a language familiar to you - Java, C#, Objective-C, C.
- C under the hood so your code moves fast.
- Battle tested in popular frameworks like React Native.
LWJGL implementation
Unlike the official Yoga Java bindings, the LWJGL bindings directly expose the native C API. YGNodeRef handles do not need to be wrapped in Java
instances, so there is no memory overhead. The internal Yoga structs are also exposed, which makes it very efficient to read the current tree layout
after a call to NodeCalculateLayout:
// Public API, 4x JNI call overhead
float l = YGNodeLayoutGetLeft(node);
float t = YGNodeLayoutGetTop(node);
float w = YGNodeLayoutGetWidth(node);
float h = YGNodeLayoutGetHeight(node);
// Internal API without overhead (plain memory accesses, assuming allocations are eliminated via EA)
YGLayout layout = YGNode.create(node).layout();
float l = layout.positions(YGEdgeLeft);
float t = layout.positions(YGEdgeTop);
float w = layout.dimensions(YGDimensionWidth);
float h = layout.dimensions(YGDimensionHeight);-
Interface Summary Interface Description YGBaselineFuncI TypeYGCloneNodeFuncI TypeYGDirtiedFuncI TypeYGLoggerI TypeYGMeasureFuncI TypeYGNodeCleanupFuncI TypeYGPrintFuncI Type -
Class Summary Class Description CompactValue Unstable/private API.CompactValue.Buffer An array ofCompactValuestructs.YGBaselineFunc TypeYGCachedMeasurement Unstable/private API.YGCachedMeasurement.Buffer An array ofYGCachedMeasurementstructs.YGCloneNodeFunc TypeYGDirtiedFunc TypeYGFloatOptional LayoutYGFloatOptional.Buffer An array ofYGFloatOptionalstructs.YGLayout Unstable/private API.YGLayout.Buffer An array ofYGLayoutstructs.YGLogger TypeYGMeasureFunc TypeYGNode Unstable/private API.YGNode.Buffer An array ofYGNodestructs.YGNodeCleanupFunc TypeYGPrintFunc TypeYGSize LayoutYGSize.Buffer An array ofYGSizestructs.YGStyle Unstable/private API.YGStyle.Buffer An array ofYGStylestructs.YGValue LayoutYGValue.Buffer An array ofYGValuestructs.Yoga Native bindings to Yoga.