Skip to content
Snippets Groups Projects
Verified Commit df70a0cd authored by Louis's avatar Louis :fire:
Browse files

Include LDTK data versions 1.0.0 to 1.2.3

parent ec4a4968
No related branches found
No related tags found
No related merge requests found
...@@ -2077,7 +2077,7 @@ dependencies = [ ...@@ -2077,7 +2077,7 @@ dependencies = [
[[package]] [[package]]
name = "micro_ldtk" name = "micro_ldtk"
version = "0.3.0-beta.1" version = "0.3.0-beta.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bevy", "bevy",
......
...@@ -14,6 +14,15 @@ license = "Apache-2.0" ...@@ -14,6 +14,15 @@ license = "Apache-2.0"
default = ["ldtk_1_2_5", "autotile"] default = ["ldtk_1_2_5", "autotile"]
ldtk_1_2_5 = [] ldtk_1_2_5 = []
ldtk_1_2_4 = [] ldtk_1_2_4 = []
ldtk_1_2_3 = []
ldtk_1_2_2 = []
ldtk_1_2_1 = []
ldtk_1_2_0 = []
ldtk_1_1_3 = []
ldtk_1_1_2 = []
ldtk_1_1_1 = []
ldtk_1_1_0 = []
ldtk_1_0_0 = []
autotile = ["micro_autotile"] autotile = ["micro_autotile"]
no_panic = [] no_panic = []
......
...@@ -23,10 +23,29 @@ micro_ldtk = { version = "0.3.0-beta.1", default-features = false, features = [" ...@@ -23,10 +23,29 @@ micro_ldtk = { version = "0.3.0-beta.1", default-features = false, features = ["
### Features ### Features
- `autotile`: Provides type conversions from LDTK projects to [micro_autotile](https://crates.io/crates/micro_autotile) `AutoRuleSet` structs. Re-exports `micro_autotile` as `autotile`. - `autotile`: Provides type conversions from LDTK projects to [micro_autotile](https://crates.io/crates/micro_autotile) `AutoRuleSet` structs. Re-exports `micro_autotile` as `autotile`.
- `ldtk_1_2_5`: Provides support for LDTK schema version 1.2.5
- `ldtk_1_2_4`: Provides support for LDTK schema version 1.2.4
- `no_panic`: Replaces explicit `panic!` calls (unwrap, expect, panic, etc) with aborts. This can reduce WASM binary size, but may not cover all areas. PRs welcome. - `no_panic`: Replaces explicit `panic!` calls (unwrap, expect, panic, etc) with aborts. This can reduce WASM binary size, but may not cover all areas. PRs welcome.
#### LDTK Versions
Supported versions of LDTK are enabled by using feature flags. Only one flag should be enabled at a time, otherwise the exported types will conflict.
Some versions don't have any schema changes, meaning that some flags will have identical data structures - check the change log for your LDTK
version to see if there are any changes. _Schema changes are considered to be **any** change, addition, or removal in the JSON schema that affects any
field or property other than metadata, e.g. schema title & schema version_
If you only access basic data about a map, there is a strong chance that updating to the latest version will not require any changes
to your code. The easiest way to make sure your project will work with a certain LDTK version is to open the `ldtk` file in the
corresponding version of LDTK and save it again.
| Feature Flag | Uses Schema Version |
|----------------------------|-------------------------------------------------------------------------------|
| `ldtk_1_2_5` | [v1.2.5](https://github.com/deepnight/ldtk/blob/v1.2.5/docs/JSON_SCHEMA.json) |
| `ldtk_1_2_4` | [v1.2.4](https://github.com/deepnight/ldtk/blob/v1.2.4/docs/JSON_SCHEMA.json) |
| `ldtk_1_2_3`, `ldtk_1_2_2` | [v1.2.2](https://github.com/deepnight/ldtk/blob/v1.2.2/docs/JSON_SCHEMA.json) |
| `ldtk_1_2_1`, `ldtk_1_2_0` | [v1.2.0](https://github.com/deepnight/ldtk/blob/v1.2.0/docs/JSON_SCHEMA.json) |
| `ldtk_1_1_3`, `ldtk_1_1_2` | [v1.1.2](https://github.com/deepnight/ldtk/blob/v1.1.2/docs/JSON_SCHEMA.json) |
| `ldtk_1_1_1`, `ldtk_1_1_0` | [v1.1.0](https://github.com/deepnight/ldtk/blob/v1.1.0/docs/JSON_SCHEMA.json) |
| `ldtk_1_0_0` | [v1.0.0](https://github.com/deepnight/ldtk/blob/v1.0.0/docs/JSON_SCHEMA.json) |
## Usage ## Usage
First, include the plugin in your app. This will include an asset loader for LDTK files, and will create resources for indexed levels and tilesets. First, include the plugin in your app. This will include an asset loader for LDTK files, and will create resources for indexed levels and tilesets.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#[cfg(feature = "ldtk_1_2_5")] #[cfg(feature = "ldtk_1_0_0")]
mod data_1_2_5; mod data_1_0_0;
#[cfg(any(feature = "ldtk_1_1_1", feature = "ldtk_1_1_0"))]
mod data_1_1_0;
#[cfg(any(feature = "ldtk_1_1_3", feature = "ldtk_1_1_2"))]
mod data_1_1_2;
#[cfg(any(feature = "ldtk_1_2_1", feature = "ldtk_1_2_0"))]
mod data_1_2_1;
#[cfg(any(feature = "ldtk_1_2_3", feature = "ldtk_1_2_2"))]
mod data_1_2_2;
#[cfg(feature = "ldtk_1_2_4")] #[cfg(feature = "ldtk_1_2_4")]
mod data_1_2_4; mod data_1_2_4;
#[cfg(feature = "ldtk_1_2_5")]
mod data_1_2_5;
use bevy::asset::{AssetLoader, BoxedFuture, LoadContext, LoadedAsset}; use bevy::asset::{AssetLoader, BoxedFuture, LoadContext, LoadedAsset};
use bevy::reflect::{TypeUuid, Uuid}; use bevy::reflect::{TypeUuid, Uuid};
#[cfg(feature = "ldtk_1_0_0")]
pub use data_1_0_0::*;
#[cfg(any(feature = "ldtk_1_1_1", feature = "ldtk_1_1_0"))]
pub use data_1_1_0::*;
#[cfg(any(feature = "ldtk_1_1_3", feature = "ldtk_1_1_2"))]
pub use data_1_1_2::*;
#[cfg(any(feature = "ldtk_1_2_1", feature = "ldtk_1_2_0"))]
pub use data_1_2_1::*;
#[cfg(any(feature = "ldtk_1_2_3", feature = "ldtk_1_2_2"))]
pub use data_1_2_2::*;
#[cfg(feature = "ldtk_1_2_4")] #[cfg(feature = "ldtk_1_2_4")]
pub use data_1_2_4::*; pub use data_1_2_4::*;
#[cfg(feature = "ldtk_1_2_5")] #[cfg(feature = "ldtk_1_2_5")]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment