Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: TMX Lib  (Read 5043 times)

0 Members and 1 Guest are viewing this topic.

aquemy

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
TMX Lib
« on: September 21, 2012, 07:35:38 pm »
Hi all,

I would like to present you a little project which is not directly related to the SFML : TMX Lib, a simple loader for tmx files.

Why a new library for tmx format ?

I was a little bit desapointed by existing tools for manipulating TMX format, due to a lack of features or a some weird dependencies.
Indeed, the most part of libraries depend on renderer libraries such as SDL or SFML or make suppositions on the use of Tile Map Editor.

Moreover, I did not see a tmx tool with a build system and continous integration, examples, etc.

Features

Let me sum-up the implemented features
  • Map loading from tmx format :
    • XML Data
    • CSV Data
       
  • Base64 decoding
  • ZLIB & GZIP Compression
  • CMake module for easy-use
  • Getters (only) in order to oblige to make a wrapper with your own engine
  • No supposition on the use, for more flexibility

A tiny TODO list :

  • Exhaustive tests
  • Multithread loading
  • Loading data from memory
  • Move semantic for a wrapper with a tiny footprint
  • Standard Library inheritance for an easy-use of standard algorithms
  • More examples !

Technologies
TMXLib is based on Boost for the XML Parser, and, at the moment I also use it for regex.
The use of boost::regex is temporary because I developped TMX with the new C++ standard for a lot of reasons, and the std::regex is not currently implemented in C++ compilers.

I use CMake as build system, then, if you use SFML, you would be familiar with this powerful tool. :D

Finaly, I plan to avoid the Boost dependence by using an abstract parser that will enable you to use any parser you would like.

Download

GitHub

You can find TMX Lib on GitHub repository :
https://github.com/aquemy/TMXLib

Some stats :
https://www.ohloh.net/p/TMXLib

Installation

Quicky :

mkdir build && cd build
cmake ..
make


That's all.

Example using SFML
Compilation
Sources are provided with the library, but as you need the SFML  to compile this example, it is disabled by default.
Simply start CMake with the following lines :

cd build
cmake .. -DSFML_EXAMPLE=true
make -j


How to use it

Finaly, the example is just a basic tmx viewer and you have to specify to the standard input, the path to the tmx file you want to see. I provide an example, with graphic ressources :

cd build/examples/SFML
./tmxExample ressource/map.tmx


Available keys :
  •     Z Q S D : Move
  •     A E : Rotate
  •    + - : Zoom and dézoom
  •    0 ... 9 : Enable / Disable layers

Disclaimer :p
This is a minimal example. Do NOT use it in your project. There is no encapsulation, it loads only maps with a single tileset, and this is not optimized.

And a little screen :
http://ompldr.org/vZmt2Yw

 

anything