justgook/elm-tiled/1.0.0

NOTE: the latest version is 3.0.2

Tiled.Tileset

type Tileset
= Source SourceTileData
| Embedded EmbeddedTileData
| ImageCollection ImageCollectionTileData
decode : Decoder Tileset
encode : Tileset -> Value
type alias SourceTileData =
{ firstgid : Int
, source : String
}
  • firstgid GID corresponding to the first tile in the set
  • source url to EmbeddedTileData
type alias EmbeddedTileData =
{ columns : Int
, firstgid : Int
, image : String
, imageheight : Int
, imagewidth : Int
, margin : Int
, name : String
, spacing : Int
, tilecount : Int
, tileheight : Int
, tilewidth : Int
, transparentcolor : String
, tiles : Dict Int TilesData
, properties : Properties
}
  • columns The number of tile columns in the tileset
  • firstgid GID corresponding to the first tile in the set
  • image Image used for tiles in this set
  • imagewidth Width of source image in pixels
  • imageheight Height of source image in pixels
  • margin Buffer between image edge and first tile (pixels)
  • name Name given to this tileset
  • spacing Spacing between adjacent tiles in image (pixels)
  • tilecount The number of tiles in this tileset
  • tileheight Maximum height of tiles in this set
  • tiles Dict of TilesData TilesData
  • tilewidth Maximum width of tiles in this set
  • properties A list of properties (name, value, type).
{ columns : Int
, firstgid : Int
, margin : Int
, name : String
, spacing : Int
, tilecount : Int
, tilewidth : Int
, tileheight : Int
, tiles : Dict Int ImageCollectionTileDataTile
, properties : Properties
, grid : Maybe GridData
}
  • columns The number of tile columns in the tileset
  • firstgid GID corresponding to the first tile in the set
  • margin Buffer between image edge and first tile (pixels)
  • name Name given to this tileset
  • spacing Spacing between adjacent tiles in image (pixels)
  • tilecount The number of tiles in this tileset
  • tileheight Maximum height of tiles in this set
  • tiles Dict of ImageCollectionTileDataTile
  • tilewidth Maximum width of tiles in this set
  • properties A list of properties (name, value, type).
type alias TilesData =
TilesDataPlain {}
TilesDataPlain
{ image : String
, imageheight : Int
, imagewidth : Int
}
{ draworder : DrawOrder
, name : String
, objects : List Object
, opacity : Int
, visible : Bool
, x : Int
, y : Int
}
type alias SpriteAnimation =
{ duration : Int
, tileid : Int
}

Decode tileset from file

decodeFile : Int -> Decoder Tileset

Internal stuff

type alias GridData =
{ height : Int
, orientation : String
, width : Int
}

stuff to delete

decodeTilesData : Decoder (Maybe (TilesDataPlain { id : Int }))
encodeTilesData : ( Int, TilesDataPlain a ) -> Value