### Install go-tiled Source: https://github.com/lafriks/go-tiled/blob/main/README.md Installs the go-tiled package using the go get command. It also mentions how to update the package using `go get -u` and the behavior with Go modules. ```sh go get github.com/lafriks/go-tiled ``` -------------------------------- ### Get go-tiled Documentation Source: https://github.com/lafriks/go-tiled/blob/main/README.md Provides instructions on how to access further documentation for the go-tiled library, either through the pkg.go.dev website or by running the `godoc` command locally. ```sh godoc github.com/lafriks/go-tiled ``` -------------------------------- ### Basic Usage of go-tiled Source: https://github.com/lafriks/go-tiled/blob/main/README.md Demonstrates the basic usage of the go-tiled library. It shows how to load a TMX file, handle potential errors during parsing, and then use the renderer to render a map layer to an in-memory image. It also includes steps for clearing the renderer's output and saving the image. ```go package main import ( "fmt" "os" "github.com/lafriks/go-tiled" "github.com/lafriks/go-tiled/render" ) const mapPath = "maps/map.tmx" // Path to your Tiled Map. func main() { // Parse .tmx file. gameMap, err := tiled.LoadFile(mapPath) if err != nil { fmt.Printf("error parsing map: %s", err.Error()) os.Exit(2) } fmt.Println(gameMap) // You can also render the map to an in-memory image for direct // use with the default Renderer, or by making your own. renderer, err := render.NewRenderer(gameMap) if err != nil { fmt.Printf("map unsupported for rendering: %s", err.Error()) os.Exit(2) } // Render just layer 0 to the Renderer. err = renderer.RenderLayer(0) if err != nil { fmt.Printf("layer unsupported for rendering: %s", err.Error()) os.Exit(2) } // Get a reference to the Renderer's output, an image.NRGBA struct. img := renderer.Result // Clear the render result after copying the output if separation of // layers is desired. renderer.Clear() // And so on. You can also export the image to a file by using the // Renderer's Save functions. } ``` -------------------------------- ### Using Embedded Filesystems with go-tiled Source: https://github.com/lafriks/go-tiled/blob/main/README.md Illustrates how to use the `embed` package with go-tiled. It shows the necessary modifications to `LoadFile` and `NewRenderer` functions to include `WithFileSystem` when working with embedded file systems. ```go tm, err := tiled.LoadFile(mapPath, tiled.WithFileSystem(assets.Files)) ... r, err := render.NewRendererWithFileSystem(tm, assets.Files) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.