Versions in this module Expand all Collapse all v1 v1.2.0 Dec 20, 2025 v1.1.0 Dec 19, 2025 v1.0.1 Dec 18, 2025 v1.0.0 Dec 18, 2025 Changes in this version + var ErrEmptyLayerData = errors.New("tiled: missing layer data") + var ErrInvalidDecodedTileCount = errors.New("tiled: invalid decoded tile count") + var ErrInvalidObjectPoint = errors.New("tiled: invalid object point") + var ErrInvalidTileGID = errors.New("tiled: invalid tile GID") + var ErrUnknownCompression = errors.New("tiled: invalid compression method") + var ErrUnknownEncoding = errors.New("tiled: unknown data encoding") + var NilLayerTile = &LayerTile + type AnimationFrame struct + Duration uint32 + TileID uint32 + type Axis string + const AxisX + const AxisY + type Data struct + Compression string + DataTiles []*DataTile + Encoding string + RawData []byte + type DataTile struct + GID uint32 + type Ellipse struct + type Group struct + Class string + Groups []*Group + ID uint32 + ImageLayers []*ImageLayer + Layers []*Layer + Name string + ObjectGroups []*ObjectGroup + OffsetX int + OffsetY int + Opacity float32 + ParallaxX float32 + ParallaxY float32 + Properties Properties + Visible bool + func (g *Group) DecodeGroup(m *Map) error + func (g *Group) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + type HexColor struct + func NewHexColor(r, g, b, a uint32) HexColor + func ParseHexColor(s string) (HexColor, error) + func (color *HexColor) MarshalXMLAttr(name xml.Name) (attr xml.Attr, err error) + func (color *HexColor) RGBA() (r, g, b, a uint32) + func (color *HexColor) String() string + func (color *HexColor) UnmarshalXMLAttr(attr xml.Attr) error + type Image struct + Data *Data + Format string + Height int + Source string + Trans *HexColor + Width int + type ImageLayer struct + Class string + ID uint32 + Image *Image + Name string + OffsetX int + OffsetY int + Opacity float32 + ParallaxX float32 + ParallaxY float32 + Properties Properties + RepeatX bool + RepeatY bool + Visible bool + X int + Y int + func (l *ImageLayer) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + type Layer struct + Class string + ID uint32 + Name string + OffsetX int + OffsetY int + Opacity float32 + ParallaxX float32 + ParallaxY float32 + Properties Properties + Tiles []*LayerTile + Visible bool + func (l *Layer) DecodeLayer(m *Map) error + func (l *Layer) GetTilePosition(tileID int) (int, int) + func (l *Layer) IsEmpty() bool + func (l *Layer) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + type LayerTile struct + DiagonalFlip bool + HorizontalFlip bool + ID uint32 + Nil bool + Tileset *Tileset + VerticalFlip bool + func (t *LayerTile) GetTileRect() image.Rectangle + func (t *LayerTile) IsNil() bool + type LoaderOption func(*loader) + func WithFileSystem(fileSystem fs.FS) LoaderOption + type Map struct + BackgroundColor *HexColor + Class string + Groups []*Group + Height int + HexSideLength int + ImageLayers []*ImageLayer + Layers []*Layer + NextObjectID uint32 + ObjectGroups []*ObjectGroup + Orientation string + Properties *Properties + RenderOrder string + StaggerAxis Axis + StaggerIndex StaggerIndexType + TileHeight int + TileWidth int + TiledVersion string + Tilesets []*Tileset + Version string + Width int + func LoadFile(fileName string, options ...LoaderOption) (*Map, error) + func LoadReader(baseDir string, r io.Reader, options ...LoaderOption) (*Map, error) + func (m *Map) GetFileFullPath(fileName string) string + func (m *Map) TileGIDToTile(gid uint32) (*LayerTile, error) + func (m *Map) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + type Object struct + Class string + Ellipses []*Ellipse + GID uint32 + Height float64 + ID uint32 + Name string + PolyLines []*PolyLine + Polygons []*Polygon + Properties Properties + Rotation float64 + Template *Template + TemplateLoaded bool + TemplateSource string + Text *Text + Type string + Visible bool + Width float64 + X float64 + Y float64 + func (o *Object) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + type ObjectGroup struct + Class string + Color *HexColor + DrawOrder string + ID uint32 + Name string + Objects []*Object + OffsetX int + OffsetY int + Opacity float32 + ParallaxX float32 + ParallaxY float32 + Properties Properties + Visible bool + func (g *ObjectGroup) DecodeObjectGroup(m *Map) error + func (g *ObjectGroup) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + type Point struct + X float64 + Y float64 + type Points []*Point + func (m *Points) UnmarshalXMLAttr(attr xml.Attr) error + type PolyLine struct + Points *Points + type Polygon struct + Points *Points + type Properties []*Property + func (p Properties) Get(name string) []string + func (p Properties) GetBool(name string) bool + func (p Properties) GetColor(name string) color.Color + func (p Properties) GetFloat(name string) float64 + func (p Properties) GetInt(name string) int + func (p Properties) GetString(name string) string + type Property struct + Name string + Type string + Value string + func (p *Property) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + type StaggerIndexType string + const StaggerIndexEven + const StaggerIndexOdd + type Template struct + Object *Object + Tileset *Tileset + type Terrain struct + Name string + Properties Properties + Tile uint32 + type Text struct + Bold bool + Color *HexColor + FontFamily string + HAlign string + Italic bool + Kerning bool + Size int + Strikethrough bool + Text string + Underline bool + VAlign string + Wrap bool + func (t *Text) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + type Tileset struct + Class string + Columns int + FirstGID uint32 + Image *Image + Margin int + Name string + Properties Properties + Source string + SourceLoaded bool + Spacing int + TerrainTypes []*Terrain + TileCount int + TileHeight int + TileOffset *TilesetTileOffset + TileWidth int + TiledVersion string + Tiles []*TilesetTile + Version string + WangSets WangSets + func LoadTilesetFile(fileName string, options ...LoaderOption) (*Tileset, error) + func LoadTilesetReader(baseDir string, r io.Reader, options ...LoaderOption) (*Tileset, error) + func (ts *Tileset) BaseDir() string + func (ts *Tileset) GetFileFullPath(fileName string) string + func (ts *Tileset) GetTileRect(tileID uint32) image.Rectangle + func (ts *Tileset) GetTilesetTile(tileID uint32) (*TilesetTile, error) + func (ts *Tileset) SetBaseDir(baseDir string) + type TilesetTile struct + Animation []*AnimationFrame + Class string + Height int + ID uint32 + Image *Image + ObjectGroups []*ObjectGroup + Probability float32 + Properties Properties + Terrain string + Type string + Width int + X int + Y int + type TilesetTileOffset struct + X int + Y int + type WangColor struct + Class string + Color string + Name string + Probability float32 + TileID int64 + type WangPosition int + const Bottom + const BottomLeft + const BottomRight + const Left + const Right + const Top + const TopLeft + const TopRight + type WangSet struct + Class string + Name string + TileID int64 + Type string + WangColors []*WangColor + WangTiles []*WangTile + func (w *WangSet) GetWangColors(tileID uint32) (map[WangPosition]*WangColor, error) + type WangSets []*WangSet + type WangTile struct + TileID uint32 + WangID string