#ldtk #level-design

ldtk2

A thin crate for people who just want to use ldtk files freely

15 releases (6 breaking)

0.7.0 Apr 25, 2022
0.6.0 Mar 30, 2022
0.5.1 Aug 26, 2021
0.4.0 Aug 25, 2021
0.1.5 Feb 12, 2021

#107 in Game dev

Download history 13/week @ 2022-01-27 5/week @ 2022-02-03 14/week @ 2022-02-17 1/week @ 2022-03-03 26/week @ 2022-03-10 52/week @ 2022-03-17 10/week @ 2022-03-24 11/week @ 2022-03-31 4/week @ 2022-04-07 1/week @ 2022-04-14 20/week @ 2022-04-21 109/week @ 2022-04-28 70/week @ 2022-05-05 241/week @ 2022-05-12

441 downloads per month

Apache-2.0

63KB
923 lines

Crates.io Documentation License Workflow Status

ldtk2

A thin crate for people who just want to use ldtk files freely.

Why did I create this nonsense?

  • LDtk-rs uses code generation, it does not get autocomplete support from rust-analyzer. Also, there are special license restrictions on using that crate.
  • ldtk_rust uses .except() inside the crate, you can't handle errors.

Supported LDtk file versions

^1.1.3

Usage

cargo add ldtk2
use std::{error::Error, path::Path, convert::TryInto};

fn main() -> Result<(), Box<dyn Error>> {
  use ldtk2::Ldtk;

  let map = Ldtk::from_path("tests/example.ldtk")?;
  // or
  let map: Ldtk = Path::new("tests/example.ldtk").try_into()?;
  // or
  let map = Ldtk::from_str(include_str!("../tests/example.ldtk"))?;
  // or
  let map: Ldtk = include_str!("../tests/example.ldtk").try_into()?;

  Ok(())
}

Dependencies

~0.7–1.4MB
~32K SLoC