Go to file
LeRoyce Pearson 6a7bcc493f feat: update to zig 0.11.0 2024-01-02 21:11:00 -07:00
src feat: update to zig 0.11.0 2024-01-02 21:11:00 -07:00
.gitignore feat: update to zig 0.11.0 2024-01-02 21:11:00 -07:00
LICENSE Add LICENSE file 2022-08-03 13:21:40 -06:00
README.md Update README.md 2022-08-05 19:40:24 -06:00
build.zig feat: update to zig 0.11.0 2024-01-02 21:11:00 -07:00

README.md

Zig LDtk

This is a single file library for parsing LDtk JSON files. Ldtk is a level editor for 2D games that allows you to organize many levels in one large world.

Usage

Copy LDtk.zig into your project, or add this repository as a git submodule.

const LDtk = @import("./LDtk.zig");

// ldtk_file should be a `[]const u8` of the file contents
const ldtk = LDtk.parse(allocator, ldtk_file);
defer ldtk.deinit();

// Now you can access your LDtk data through the `ldtk` struct
for (ldtk   .levels) {
    // ...
}

Features

  • Parse unseperated LDtk file
  • Parse seperated LDtk files
  • Load unseperated LDtk
  • Load seperated LDtk
  • Supported JSON Schema
    • 1. LDtk Json root
      • 1.1. World Generic
    • 2. Level
      • 2.1. Layer instance
      • 2.2. Tile instance Generic
      • 2.3. Entity instance
      • 2.4. Field instance
        • 2.4.2. Field instance entity reference Generic
        • 2.4.3. Field instance grid point Generic
    • 3. Definitions
      • 3.1. Layer definition
        • 3.1.1. Auto-layer rule definition
      • 3.2. Entity definition
        • 3.2.1. Field definition Generic
        • 3.2.2. Tileset rectangle Generic
      • 3.3. Tileset definition
      • 3.4. Enum definition
        • 3.4.1. Enum value definition