aboutsummaryrefslogtreecommitdiffstats

tmz

A library for parsing and loading Tiled JSON Maps and JSON Tilesets in Zig.

Getting started

const allocator = std.heap.page_allocator;

const parsed_map = try tmz.parseJson(@embedFile("map.tmj"), allocator);
defer parsed_map.deinit();

const map = parsed_map.map;
std.debug.print("Map size: {}x{}\n", .{ map.height, map.width });

Use in your own projects

  1. Add tmz to your build.zig.zon
zig fetch --save https://git.sadbeast.com/tmz/snapshot/tmz-main.tar.gz

or manually:

.dependencies = .{
    .tmz = .{
        .url = "https://git.sadbeast.com/tmz/snapshot/tmz-main.tar.gz",
        .hash = "122049a7810f7bd222fc2d65204c85d0cf867ab03063bb11c8086b452092d9f1a4b5",
    },
},
  1. Add tmz to your build.zig
const tmz = b.dependency("tmz", .{
    .target = target,
    .optimize = optimize,
});

exe.root_module.addImport("tmz", tmz.module("tmz"));

Documentation

Generated docs

Building

To build static library and tmj-viewer executable:

$ zig build install

Dependencies

  • Zig 0.12.0
  • kcov (optional - for test coverage)

Nix

If you have Nix, nix develop and/or if you have direnv, direnv allow to get a development shell with above dependencies

Contributing

Email patches to sadbeast@sadbeast.com