Class TmxMapWriter

java.lang.Object
java.io.Writer
com.badlogic.gdx.utils.XmlWriter
net.dermetfan.gdx.maps.tiled.TmxMapWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable, java.lang.AutoCloseable

public class TmxMapWriter
extends com.badlogic.gdx.utils.XmlWriter
A XmlWriter with additional tmx(..) methods. Note: Not available in GWT.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  TmxMapWriter.Format
    the encoding of layer data
  • Field Summary

    Fields inherited from class com.badlogic.gdx.utils.XmlWriter

    indent

    Fields inherited from class java.io.Writer

    lock
  • Constructor Summary

    Constructors
    Constructor Description
    TmxMapWriter​(java.io.Writer writer)
    creates a new TmxMapWriter using the given Writer
  • Method Summary

    Modifier and Type Method Description
    int getLayerHeight()  
    void setLayerHeight​(int layerHeight)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.MapLayer layer)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.MapLayers layers, TmxMapWriter.Format format)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.MapObject object)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.MapObjects objects)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.MapProperties properties)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.MapProperties properties, com.badlogic.gdx.utils.Array<java.lang.String> exclude)
    writes nothing if the given MapProperties are empty or every key is excluded
    TmxMapWriter tmx​(com.badlogic.gdx.maps.Map map, TmxMapWriter.Format format)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.tiled.TiledMapTileLayer layer, TmxMapWriter.Format format)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.tiled.TiledMapTileSet set)  
    TmxMapWriter tmx​(com.badlogic.gdx.maps.tiled.TiledMapTileSets sets)  
    float toYDown​(float y)  
    int toYDown​(int y)  

    Methods inherited from class com.badlogic.gdx.utils.XmlWriter

    attribute, close, element, element, flush, pop, text, write

    Methods inherited from class java.io.Writer

    append, append, append, nullWriter, write, write, write, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TmxMapWriter

      public TmxMapWriter​(java.io.Writer writer)
      creates a new TmxMapWriter using the given Writer
  • Method Details

    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.Map map, TmxMapWriter.Format format) throws java.io.IOException
      Parameters:
      map - the Map to write in TMX format
      format - the TmxMapWriter.Format to use
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.MapProperties properties) throws java.io.IOException
      Parameters:
      properties - the MapProperties to write in TMX format
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.MapProperties properties, com.badlogic.gdx.utils.Array<java.lang.String> exclude) throws java.io.IOException
      writes nothing if the given MapProperties are empty or every key is excluded
      Parameters:
      properties - the MapProperties to write in TMX format
      exclude - the keys not to write
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.tiled.TiledMapTileSets sets) throws java.io.IOException
      Parameters:
      sets - the TiledMapTileSets to write in TMX format
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.tiled.TiledMapTileSet set) throws java.io.IOException
      Parameters:
      set - the TiledMapTileSet to write in TMX format
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.MapLayers layers, TmxMapWriter.Format format) throws java.io.IOException
      Parameters:
      layers - the MapLayers
      format - the TmxMapWriter.Format to use
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.MapLayer layer) throws java.io.IOException
      Parameters:
      layer - the MapLayer to write in TMX format
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.tiled.TiledMapTileLayer layer, TmxMapWriter.Format format) throws java.io.IOException
      Parameters:
      layer - the TiledMapTileLayer to write in TMX format
      format - the TmxMapWriter.Format to use
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.MapObjects objects) throws java.io.IOException
      Parameters:
      objects - the MapObject to write in TMX format
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • tmx

      public TmxMapWriter tmx​(com.badlogic.gdx.maps.MapObject object) throws java.io.IOException
      Parameters:
      object - the MapObject to write in TMX format
      Returns:
      this TmxMapWriter
      Throws:
      java.io.IOException
    • toYDown

      public int toYDown​(int y)
      See Also:
      toYDown(float)
    • toYDown

      public float toYDown​(float y)
      Parameters:
      y - the y coordinate
      Returns:
      the y coordinate converted from a y-up to a y-down coordinate system
    • getLayerHeight

      public int getLayerHeight()
      Returns:
      the layerHeight
    • setLayerHeight

      public void setLayerHeight​(int layerHeight)
      Parameters:
      layerHeight - the layerHeight to set