KaseyJenkins / tinytmx

A C++17 library to parse TMX maps generated by Tiled Map Editor.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMakeLinux CMakeWindows CMakeMacOS

tinytmx

Description

A C++17 library to parse maps generated by Tiled Map Editor. Fully supports TMX Map Format version 1.5.

Features

  • Conformity with the TMX specification page.
    • (Currently supports TMX Map Format version 1.5. Earlier versions are not officially supported.)

Requirements

The library requires C++17 to build, including compiler and standard library support.

Dependencies

Library Version
TinyXML2 9.0.0
zlib 1.2.13
zstd 1.5.2

Installation

This describes the installation process using cmake. As pre-requisites, you'll need git and cmake installed.

# Check out the library.
$ git clone https://github.com/KaseyJenkins/tinytmx.git
# Go to the library root directory
$ cd tinytmx
# Make a build directory to place the build output.
$ cmake -E make_directory "build"
# Generate build system files with cmake.
$ cmake -E chdir "build" cmake -DCMAKE_BUILD_TYPE=Release ../
# or, starting with CMake 3.13, use a simpler form:
# cmake -DCMAKE_BUILD_TYPE=Release -S . -B "build"
# Build the library.
$ cmake --build "build" --config Release

If you want to install the library globally, run:

sudo cmake --build "build" --config Release --target install

Usage

Basic usage

Parsing a Tiled TMX Map:

#include <string>
#include "tinytmx.hpp"

int main(int argc, char * argv[]) {
    
    tinytmx::Map *map = new tinytmx::Map();
    std::string fileName = "assets/FiniteOrthogonalMap.tmx";
    map->ParseFile(fileName);
    
}

Usage with CMake

If using CMake, it is recommended to link against the project-provided tinytmx::tinytmx target using target_link_libraries.

It is possible to use find_package to import an installed version of the library.

find_package(tinytmx REQUIRED)

Alternatively, add_subdirectory will incorporate the library directly into one's CMake project.

add_subdirectory(tinytmx)

Either way, link to the library as follows.

target_link_libraries(MyTarget tinytmx::tinytmx)

About

A C++17 library to parse TMX maps generated by Tiled Map Editor.

License:Other


Languages

Language:C++ 93.6%Language:CMake 6.4%