https://github.com/go-stuff/tiled
Loading 'TMX Map Format' files created by 'Tiled' into Go structs.
https://github.com/go-stuff/tiled
go golang tiled tmx
Last synced: 3 months ago
JSON representation
Loading 'TMX Map Format' files created by 'Tiled' into Go structs.
- Host: GitHub
- URL: https://github.com/go-stuff/tiled
- Owner: go-stuff
- License: mit
- Created: 2020-01-05T13:09:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-23T11:40:43.000Z (over 6 years ago)
- Last Synced: 2024-06-20T12:51:47.756Z (almost 2 years ago)
- Topics: go, golang, tiled, tmx
- Language: Go
- Homepage:
- Size: 375 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tiled
[](https://opensource.org/licenses/MIT)

Loading [TMX Map Format](https://doc.mapeditor.org/de/stable/reference/tmx-map-format/#tmx-map-format) files created by the [Tiled](https://www.mapeditor.org/) map editor into a [Go](https://golang.org/) struct. This package does not do anything fancy, it does not do any decoding, it unmarshalls data from `.tmx` and `.tsx` files and populates a `tmx.Map` struct. It updates tileset and image sources with better path information.
The [TMX Map Format](https://doc.mapeditor.org/de/stable/reference/tmx-map-format/#tmx-map-format) documentation was followed as close as possible.
A field used that is not listed in the spec is [tmx.Data.InnerXML](https://github.com/go-stuff/tiled/blob/master/tmx/data.go), it is the raw XML nested inside the tag ``.
A field used that is not listed in the spec is [tmx.Content](https://github.com/go-stuff/tiled/blob/master/tmx/content.go), it is used to preserve the order of `tmx.Map` and `tmx.Group` elements. While building a game engine, the order of each layer in Map and Group became important.
## Packages Imported
This package only uses standard libraries.
## Installation
The recommended way to get started using [github.com/go-stuff/tiled](https://github.com/go-stuff/tiled) is by using `go get` to install the dependency in your project.
```
go get github.com/go-stuff/tiled
```
## Usage
```go
package main
import (
"fmt"
"log"
"github.com/go-stuff/tiled/tmx"
)
// Test loading and printing a tmx file.
func main() {
t, err := tmx.LoadTMX("./testdata/map.tmx")
if err != nil {
log.Fatal(err)
}
fmt.Println(t.String())
}
```
## License
[MIT License](LICENSE)