estivate / ldtk_rust Goto Github PK
View Code? Open in Web Editor NEWParse LDtk JSON files into typed Rust objects.
License: MIT License
Parse LDtk JSON files into typed Rust objects.
License: MIT License
There is brand new version of LDTK app available, please update crate to support it :3
Need to add a check for the "f" flip bit to correctly flip tiles on x and/or y axis.
in 0.1.0 the field named "type" is renamed in serde to something else. For instance in the Layer struct "type" is renamed to "layer_type".
An alternative would be to preface the field name with "r#" so "type" becomes "r#type".
Not sure which would be best for consumers.
unknown variant `ExportOldTableOfContentData`, expected one of `DiscardPreCsvIntGrid`, `ExportPreCsvIntGridFormat`, `IgnoreBackupSuggest`, `MultiWorlds`, `PrependIndexToLevelFileNames`, `UseMultilinesType`
Left is bevy (using engine example almost verbatim) and right is LDTK. As you can see the offset is a bit off. Debugging now but wanted to pass it along if you had any ideas. Using git version of ldtk_rust (although I don't think there are many changes, just because I'm on 0.7.2 for LDTK).
This is the tileset I'm using, by the way.
EntityInstances can be implemented for the most part, but LDtk let's you create arbitrary fields to assign various values to Entities which is going to be an extra step in a strongly typed language like Rust. Specifically:
{
"fieldInstances":[
{
"__identifier":"text",
"__value":"Can be arbitrary text...",
"__type":"String",
"defUid":88,
},
{
"__identifier":"colors",
"__value":["#FFD500", "#FFD501", "#FFD502"],
"__type":"Array<Color>",
"defUid":90,
}
]
}
Not sure how to deal with this in Serde. I can tag it with the serde type "Value" and let the caller figure it out, or maybe I can set up an Enum to use the internally tagged __type field to pick the right option. The possible types are limiited.
Description
When loading a file that contains the use of LDtk's integrated icons, an error occurs with serde_json
: "invalid type: null, expected a string at line x column y". As far as I can tell, this relates to the relPath
field being null where it references integrated icons.
Reproduction
Create a ldtk project, create at least one thing that uses LDtk's integrated icons for its' editor representation, and export. You should find a tileset definition with relPath
set to null
. (Example file attached)
Potential Solution
Use the new embedAtlas
field to detect such cases and replace relPath
with either a Option<String>
or an enum between String
and LdtkIcons
.
Hey, first of all, thanks for making this crate, it works great and is well documented.
I wanted to quickly share that using a buffered reader on the File
s speeds loading up by a big amount, for me on windows at least.
So, for example this:
use std::io::BufReader;
...
let file = BufReader::new(File::open(f).expect("level file not found"));
instead of this:
let file = File::open(f).expect("level file not found");
This may be an easy fix but I haven't used Bevy in a while.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.