Example usage for com.badlogic.gdx.maps MapProperties getKeys

List of usage examples for com.badlogic.gdx.maps MapProperties getKeys

Introduction

In this page you can find the example usage for com.badlogic.gdx.maps MapProperties getKeys.

Prototype

public Iterator<String> getKeys() 

Source Link

Usage

From source file:com.stercore.code.net.dermetfan.utils.libgdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(MapProperties properties, int indent) {
    String hierarchy = "";
    Iterator<String> keys = properties.getKeys();
    while (keys.hasNext()) {
        String key = keys.next();
        for (int i = 0; i < indent; i++)
            hierarchy += '\t';
        hierarchy += key + ": " + properties.get(key).toString() + '\n';
    }/*from w w  w  .  j  a v a2 s .  c  om*/
    return hierarchy;
}

From source file:com.stercore.code.net.dermetfan.utils.libgdx.maps.TmxMapWriter.java

License:Apache License

/** writes nothing if the given {@link MapProperties} are empty or every key is excluded
 *  @param properties the {@link MapProperties} to write in TMX format
 *  @param exclude the keys not to write
 *  @return this {@link TmxMapWriter} */
public TmxMapWriter tmx(MapProperties properties, Array<String> exclude) throws IOException {
    Iterator<String> keys = properties.getKeys();
    if (!keys.hasNext())
        return this;

    boolean elementEmitted = false;
    while (keys.hasNext()) {
        String key = keys.next();
        if (exclude != null && exclude.contains(key, false))
            continue;
        if (!elementEmitted) {
            element("properties");
            elementEmitted = true;/* w ww .  ja  v  a 2  s . co  m*/
        }
        element("property").attribute("name", key).attribute("value", properties.get(key)).pop();
    }

    if (elementEmitted)
        pop();
    return this;
}

From source file:net.dermetfan.gdx.maps.MapUtils.java

License:Apache License

/** @see #readableHierarchy(com.badlogic.gdx.maps.Map, int) */
public static String readableHierarchy(MapProperties properties, int indent) {
    StringBuilder hierarchy = new StringBuilder();
    Iterator<String> keys = properties.getKeys();
    while (keys.hasNext()) {
        String key = keys.next();
        for (int i = 0; i < indent; i++)
            hierarchy.append('\t');
        hierarchy.append(key).append(": ").append(properties.get(key).toString()).append('\n');
    }/*from   w  w w  .  j  a  v  a  2s .  c  om*/
    return hierarchy.toString();
}