Coder Social home page Coder Social logo

heavyrain266 / odin-ldtk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jakubtomsu/odin-ldtk

0.0 1.0 0.0 71 KB

Odin loader for LDtk files. LDtk is a modern 2D level editor from the creator of Dead Cells, with a strong focus on user-friendliness.

Home Page: https://ldtk.io/

License: MIT License

Odin 100.00%

odin-ldtk's Introduction

odin-ldtk

Loader for LDtk files. Uses Odin's core:json to unmarshal data into structs.

LDtk is a modern 2D level editor from the creator of Dead Cells, with a strong focus on user-friendliness.

Current version: 1.3.3

The data definitions were generated with JSON scheme and QuickType for rust and then manually edited.

How to use

Put the ldtk.odin file to a ldtk folder somewhere in your project. Then you can just do this (the path might be different):

import "../ldtk"

And then:

if project, ok := ldtk.load_from_file("foo.ldtk", context.temp_allocator).?; ok {
    for biome in project.defs.biomes {
        // use biomes ...
    }

    for level in proj.levels {
        for layer in level.layers {
            switch layer.type {
            case .IntGrid:
            case .Entities:
            case .Tiles:
            case .AutoLayer:
            }
        }
    }

    // ...
}

Note: value in Field_Instance can be a different type depending on the data. For this reason the type is json.Value, which works like any in this case, and you can do whatever you want with it.

TODO

  • Simple example tilemap renderer (and simple physics?), using raylib.

Contributing

Contributions are welcome!

odin-ldtk's People

Contributors

jakubtomsu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.