Skip to content

manyminds/tmx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ef401b7 · Jul 12, 2016

History

32 Commits
May 12, 2016
May 12, 2016
Aug 30, 2015
Sep 10, 2015
Aug 30, 2015
Jul 12, 2016
May 11, 2016
Sep 10, 2015
Sep 10, 2015
May 11, 2016
Sep 10, 2015
May 10, 2016
Sep 10, 2015
May 12, 2016
Aug 30, 2015
May 11, 2016
May 11, 2016
May 12, 2016
May 10, 2016
May 10, 2016
May 11, 2016
May 11, 2016
Aug 30, 2015

Repository files navigation

Join the chat at https://gitter.im/manyminds/tmx

GoDoc Build Status Coverage Status Go Report Card

TMX Map File Loader

This repository aims to provide go support for maps that are saved according the the TMX Map Format

Support

This library currently supports loading of base64 encoded tile maps with either gzip, zlip or no compression.

Usage

Currently the library only provides functionality to load maps, in the future it should provide utility functions to make using tmx files even more convenient.

Renderer

To generate a preview image of your tilemap you can use the Render function:

  testfile := "example.tmx"

  reader, err := os.Open(testfile)

  m, err := tmx.NewMap(reader)
  if err != nil {
    log.Fatal(err)
  }

  canvas := tmx.NewImageCanvasFromMap(*m)

  renderer := tmx.NewRenderer(*m, canvas)
  err = renderer.Render()
  if err != nil {
    log.Fatal(err)
  }

  target, err := os.Create("result.png")
  if err != nil {
    target, err = os.Open("result.png")
    if err != nil {
      log.Fatal(err)
    }
  }
  defer target.Close()

  err = png.Encode(target, canvas.Image())
  if err != nil {
    log.Fatal(err)
  }

The renderer is still a work in progress and currently only renders tiles and layers.

About

TMX Map File Loader

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages