Giter Club home page Giter Club logo

cl-tiled's Introduction

cl-tiled

Tiled TMX/TSX and JSON map/tileset loader

About

cl-tiled is a Common Lisp library for importing TMX/TSX and JSON tilemaps and tilesets generated by Tiled. It aims to fill the same role as other engine-agnostic Tiled importers. Meaning it is not a renderer nor does it provide integration with renderers on its own. Instead it aims to provide an easy, logical way to read map data so it may be imported/rendered in whatever way you wish.

Status

alpha quality. API changes to come. Mostly additions to missing features.

Note that as a current goal, this library aims to be feature complete, not fast nor space efficient.

Current:

  • Full TMX/TSX and JSON reading support
  • Support for embedded and external tilesets
  • Support for embededd and external images
  • API support for all layer, tile, object, and terrain types
  • Full support for property objects with distinct data-types (string, number, bool, color, pathname)
  • Orthogonal map support

Planned:

  • Defining API for isometric, staggred, and hexagonal maps
  • Make the library more efficient
  • Modifying map and writing TMX/TSX and JSON files (if enough demand for this)

Please post any requests/bugs on the issues page.

Dependencies

Example

(defpackage #:my-cool-package
  (:use #:cl)
  (:local-nicknames
    (#:tiled #:cl-tiled)))
(in-package #:my-cool-package)

(defgeneric render-layer (layer))

(defmethod render-layer ((layer tiled:tile-layer))
  (dolist (cell (tiled:layer-cells layer))
    ;; tiled:cell-x and tiled:cell-y for pixel positions
    ;; tiled:cell-tile for `tiled:tile' information
    ;;  what image, which row/column within image
    ))

(defmethod render-layer ((layer tiled:image-layer))
  ;;tiled:layer-image gets you the relevant image to render
  )

(defmethod render-layer ((layer tiled:object-layer))
  (dolist (object (tiled:object-group-objects layer))
    ;; render each object according to type
    ))

(defmethod render-layer ((layer tiled:group-layer))
  ;;Render each sub-layer
  (dolist (layer (tiled:group-layers layer))
    (render-layer layer)))

(let ((tiled-map (tiled:load-map "assets/map.tmx")))
  (dolist (layer (tiled:map-layers tiled-map))
    (render-layer layer)))

Contact

Wilfredo Velázquez-Rodríguez [email protected]

cl-tiled's People

Contributors

bohonghuang avatar borodust avatar dan-passaro avatar defaultxr avatar jstoddard avatar lockie avatar nobody-significant avatar zulu-inuoe avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.