Skip to content

A libGDX java port of Yoga Layout, the layout engine which implements Flexbox. (Fork of Meditate Layout)

License

Notifications You must be signed in to change notification settings

lyze237/gdx-FlexBox

Repository files navigation

Meditate Layout

Meditate Layout is a full Java port of Yoga Layout by Facebook

License Jitpack

This fork downgrades the project to Java 8 and supports GWT.

Simple Example

Check out https://yogalayout.com/playground for a playground and https://yogalayout.com/docs (Or any other flexbox tutorial) for docs.

public class Example {
    public static void main(String[] args) {
        YogaConfig config = YogaConfigFactory.create();
        config.setUseWebDefaults(true);

        YogaNode root = YogaNodeFactory.create(config);
        root.setAlignItems(YogaAlign.FLEX_START);

        for (int i = 0; i < 10; i++) {
            YogaNode child = YogaNodeFactory.create(config);
            child.setWidth(100);
            child.setHeight(100);
            root.addChildAt(child, i);
        }

        root.getChildAt(0).setFlexGrow(1);
        
        root.calculateLayout(1920, 1080);
        
        // root.getChildAt(0).getLayoutX();
        // root.getChildAt(0).getLayoutY();
        // root.getChildAt(0).getLayoutWidth();
        // root.getChildAt(0).getLayoutHeight();
    }
}

Usage

  1. Add the JitPack repository to your build file
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency
dependencies {
        implementation 'com.github.lyze237-forks:meditate-layout:$version'
}
  1. Change the $version string to the latest version from jitpack.

About

A libGDX java port of Yoga Layout, the layout engine which implements Flexbox. (Fork of Meditate Layout)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%