All Projects → lafriks → Go Tiled

lafriks / Go Tiled

Licence: mit
Go library to parse Tiled map editor file format (TMX) and render map to image

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Tiled

Qrcode Renderer
QR Code renderer is a dependency-free library to render QR Codes. The library makes it simple to integrate with any UI framework and comes with a prebuilt SVG renderer for the web.
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Profun
Procedural vs Functional
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Docs
Documentation for Tasmota (https://github.com/arendst/Tasmota)
Stars: ✭ 55 (-3.51%)
Mutual labels:  hacktoberfest
Javascript
Implementation of All ▲lgorithms in Javascript Programming Language
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Sadpanda
Chrome extension to access ExHentai
Stars: ✭ 53 (-7.02%)
Mutual labels:  hacktoberfest
Jsk robot
jsk-ros-pkg/jsk_robot
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Dragon
⚡A powerful HTTP router and URL matcher for building Deno web servers.
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Erxes Api
API for erxes
Stars: ✭ 57 (+0%)
Mutual labels:  hacktoberfest
Aws C Io
This is a module for the AWS SDK for C. It handles all IO and TLS work for application protocols.
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Crate Python
A Python client library for CrateDB.
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Hacktoberfest 2018
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Devradar
Competence Management for developers
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Consul
Consul - Open Government and E-Participation Web Software
Stars: ✭ 1,088 (+1808.77%)
Mutual labels:  hacktoberfest
2019 Ncov Api
Map, data and timeline of coronavirus (COVID-19)
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
React Filemanager
JavaScript File Manager Material Design Folder Explorer Navigator Browser Manager in React and Redux with Mobile support (with backends for Local Files and FTP)
Stars: ✭ 57 (+0%)
Mutual labels:  hacktoberfest
Design Patterns And Principles
A collection of a number of design patterns and principles written in Kotlin
Stars: ✭ 56 (-1.75%)
Mutual labels:  hacktoberfest
Bikedeboa
A (Progressive) Web App to find, map and review bike parkings in the cities of Brazil.
Stars: ✭ 54 (-5.26%)
Mutual labels:  hacktoberfest
Ng Bootstrap Form Validation
An Angular Module for easy data driven (reactive) form validation
Stars: ✭ 57 (+0%)
Mutual labels:  hacktoberfest
Aws Iot Device Sdk Js V2
Next generation AWS IoT Client SDK for Node.js using the AWS Common Runtime
Stars: ✭ 57 (+0%)
Mutual labels:  hacktoberfest
Nextcloud Snap
☁️📦 Nextcloud packaged as a snap
Stars: ✭ 1,088 (+1808.77%)
Mutual labels:  hacktoberfest

go-tiled

PkgGoDev Build Status

Go library to parse Tiled map editor file format (TMX) and render map to image. Currently supports only orthogonal rendering out-of-the-box.

Installing

go get github.com/lafriks/go-tiled

You can use go get -u to update the package. You can also just import and start using the package directly if you're using Go modules, and Go will then download the package on first compilation.

Basic Usage

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.LoadFromFile(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.
}

Documentation

For further documentation, see https://pkg.go.dev/github.com/lafriks/go-tiled or run:

godoc github.com/lafriks/go-tiled
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].