bevy_ecs_ldtk icon indicating copy to clipboard operation
bevy_ecs_ldtk copied to clipboard

Custom Asset Sources

Open dennorak opened this issue 5 months ago • 0 comments

Hey, thank you for all the work with this crate; it's made working with LDtk levels much easier.

I'm trying to create a bundled asset format to use for my game, while using this crate. I've gotten png loading working, but I'm having some trouble manually loading my LdtkProject dynamically. At first I tried hooking into this crate's loader, and when that proved harder than it was worth (I got it to load something, but it was just a grey square). I'm guessing this is because ldtk_path_to_asset_path() doesn't take asset labels into account.

Then, I figured I'd just copy some of what's being done in the loader, and load the project myself. However, LdtkJsonWithMetadata::new() is private, with the given reasoning "Only public to the crate to preserve type guarantees about loaded levels." If there's a reason for keeping that private, it makes sense to keep it, but as it stands that means there's no real way to load an LdtkProject unless the files are separate, and are loaded by passing a path to this crate.

Any thoughts? If this isn't something you're interested in implementing, I understand, but I think it'd be beneficial to open up the loading process to a bit more customization. I'm also not set on these ways, I just figured I'd provide them as reference for what I tried, and why I'm not just suggesting code changes outright.

dennorak avatar Sep 08 '24 16:09 dennorak