Example usage for com.badlogic.gdx.scenes.scene2d Group debugAll

List of usage examples for com.badlogic.gdx.scenes.scene2d Group debugAll

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d Group debugAll.

Prototype

public Group debugAll() 

Source Link

Document

Calls #setDebug(boolean,boolean) with true, true .

Usage

From source file:com.agateau.ui.UiBuilder.java

License:Apache License

protected void applyActorProperties(Actor actor, XmlReader.Element element, Group parentActor) {
    AnchorGroup anchorGroup = null;//from ww  w  . j  a v  a  2 s  . com
    if (parentActor != null) {
        parentActor.addActor(actor);
        if (parentActor instanceof AnchorGroup) {
            anchorGroup = (AnchorGroup) parentActor;
        }
    }
    String attr = element.getAttribute("x", "");
    if (!attr.isEmpty()) {
        actor.setX(Float.parseFloat(attr));
    }
    attr = element.getAttribute("y", "");
    if (!attr.isEmpty()) {
        actor.setY(Float.parseFloat(attr));
    }
    attr = element.getAttribute("width", "");
    if (!attr.isEmpty()) {
        actor.setWidth(Float.parseFloat(attr));
    }
    attr = element.getAttribute("height", "");
    if (!attr.isEmpty()) {
        actor.setHeight(Float.parseFloat(attr));
    }
    attr = element.getAttribute("originX", "");
    if (!attr.isEmpty()) {
        actor.setOriginX(Float.parseFloat(attr));
    }
    attr = element.getAttribute("originY", "");
    if (!attr.isEmpty()) {
        actor.setOriginY(Float.parseFloat(attr));
    }
    attr = element.getAttribute("visible", "");
    if (!attr.isEmpty()) {
        actor.setVisible(Boolean.parseBoolean(attr));
    }
    attr = element.getAttribute("color", "");
    if (!attr.isEmpty()) {
        actor.setColor(Color.valueOf(attr));
    }
    attr = element.getAttribute("debug", "");
    if (!attr.isEmpty()) {
        if (actor instanceof Group) {
            Group group = (Group) actor;
            attr = attr.toLowerCase();
            if (attr.equals("true")) {
                group.debug();
            } else if (attr.equals("all")) {
                group.debugAll();
            }
        } else {
            actor.setDebug(Boolean.parseBoolean(attr));
        }
    }
    for (int idx = 0, size = ANCHOR_NAMES.length; idx < size; ++idx) {
        String anchorName = ANCHOR_NAMES[idx];
        attr = element.getAttribute(anchorName, "");
        if (!attr.isEmpty()) {
            if (anchorGroup == null) {
                throw new RuntimeException("Parent of " + actor + " is not an anchor group");
            }
            PositionRule rule = parseRule(attr, anchorGroup.getSpacing());
            rule.target = actor;
            rule.targetAnchor = ANCHORS[idx];
            anchorGroup.addRule(rule);
        }
    }
}