Documentation
¶
Overview ¶
A Go library that reads Tiled's TMX files.
Index ¶
Constants ¶
View Source
const ( GIDHorizontalFlip = 0x80000000 GIDVerticalFlip = 0x40000000 GIDDiagonalFlip = 0x20000000 GIDFlip = GIDHorizontalFlip | GIDVerticalFlip | GIDDiagonalFlip GIDMask = 0x0fffffff )
Variables ¶
View Source
var ( UnknownEncoding = errors.New("tmx: invalid encoding scheme") UnknownCompression = errors.New("tmx: invalid compression method") InvalidDecodedDataLen = errors.New("tmx: invalid decoded data length") InvalidGID = errors.New("tmx: invalid GID") InvalidPointsField = errors.New("tmx: invalid points string") )
View Source
var (
NilTile = &DecodedTile{Nil: true}
)
Functions ¶
This section is empty.
Types ¶
type DecodedTile ¶
type DecodedTile struct { ID ID Tileset *Tileset HorizontalFlip bool VerticalFlip bool DiagonalFlip bool Nil bool }
func (*DecodedTile) IsNil ¶
func (t *DecodedTile) IsNil() bool
type Layer ¶
type Layer struct { Name string `xml:"name,attr" json:"name"` Opacity float32 `xml:"opacity,attr" json:"opacity"` Visible bool `xml:"visible,attr" json:"visible"` Properties []Property `xml:"properties>property" json:"properties"` Data Data `xml:"data" json:"data"` DecodedTiles []*DecodedTile `xml:"-" json:"-"` // This is the attiribute you'd like to use, not Data. Tile entry at (x,y) is obtained using l.DecodedTiles[y*map.Width+x]. Tileset *Tileset `xml:"-" json:"-"` // This is only set when the layer uses a single tileset and NilLayer is false. Empty bool `xml:"-" json:"-"` // Set when all entries of the layer are NilTile }
type Map ¶
type Map struct { Version string `xml:"title,attr" json:"title"` Orientation string `xml:"orientation,attr" json:"orientation"` Width int `xml:"width,attr" json:"width"` Height int `xml:"height,attr" json:"height"` TileWidth int `xml:"tilewidth,attr" json:"tilewidth"` TileHeight int `xml:"tileheight,attr" json:"tileheight"` Properties []Property `xml:"properties>property" json:"properties"` Tilesets []Tileset `xml:"tileset" json:"tilesets"` Layers []Layer `xml:"layer" json:"layers"` ObjectGroups []ObjectGroup `xml:"objectgroup" json:"objectgroup"` }
All structs have their fields exported, and you'll be on the safe side as long as treat them read-only (anyone want to write 100 getters?).
type Object ¶
type Object struct { Name string `xml:"name,attr" json:"name"` Type string `xml:"type,attr" json:"type"` X float64 `xml:"x,attr" json:"x"` Y float64 `xml:"y,attr" json:"y"` Width float64 `xml:"width,attr" json:"width"` Height float64 `xml:"height,attr" json:"height"` GID int `xml:"gid,attr" json"gid"` Visible bool `xml:"visible,attr" json:"visible"` Polygons []Polygon `xml:"polygon" json:"polygon"` PolyLines []PolyLine `xml:"polyline" json:"polyline"` Properties []Property `xml:"properties>property" json:"properties"` }
type ObjectGroup ¶
type ObjectGroup struct { Name string `xml:"name,attr" json:"name"` Color string `xml:"color,attr" json:"color"` Opacity float32 `xml:"opacity,attr" json:"opacity"` Visible bool `xml:"visible,attr" json:"visible"` Properties []Property `xml:"properties>property" json:"properties"` Objects []Object `xml:"object" json:"object"` }
type Tileset ¶
type Tileset struct { FirstGID GID `xml:"firstgid,attr" json:"firstgid"` Source string `xml:"source,attr" json:"source"` Name string `xml:"name,attr" json:"name"` TileWidth int `xml:"tilewidth,attr" json:"tilewidth"` TileHeight int `xml:"tileheight,attr" json:"tileheight"` Spacing int `xml:"spacing,attr" json:"spacing"` Margin int `xml:"margin,attr" json:"margin"` Properties []Property `xml:"properties>property" json:"properties"` Image Image `xml:"image" json:"image"` Tiles []Tile `xml:"tile" json:"tile"` Tilecount int `xml:"tilecount,attr" json:"tilecount"` Columns int `xml:"columns,attr" json:"colums"` }
Directories
¶
Path | Synopsis |
---|---|
example
|
|
tmx2console
Converts a TMX file to files which can be loaded to GBA.
|
Converts a TMX file to files which can be loaded to GBA. |
Click to show internal directories.
Click to hide internal directories.