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.
FeaturesLet me sum-up the implemented features
- Map loading from tmx format :
- 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 !
TechnologiesTMXLib 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.
Finaly, I plan to avoid the Boost dependence by using an abstract parser that will enable you to use any parser you would like.
DownloadGitHubYou can find TMX Lib on GitHub repository :
https://github.com/aquemy/TMXLibSome stats :
https://www.ohloh.net/p/TMXLibInstallationQuicky :
mkdir build && cd build
cmake ..
makeThat's all.
Example using SFMLCompilationSources 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 -jHow to use itFinaly, 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.tmxAvailable keys :
- Z Q S D : Move
- A E : Rotate
- + - : Zoom and dézoom
- 0 ... 9 : Enable / Disable layers
Disclaimer :pThis 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