-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow obtaining the path of tilemaps that have been loaded #263
Comments
You're right, this isn't possible currently. |
I don't really like the idea of adding the path to the @LuckyTurtleDev Just out of curiosity, what use-case do you have where you need to know the path? |
BTW you theorically could create your own ResourceLoader and log the path of each tileset loaded that way. |
@bjorn I have writen a proc macro, with does convert the tiled map to a more easy app internal map format and check some requirements at compile time. For the the main tmx map you can simple use the path from the input of the proc macro. const _: &[u8] = ::core::include_bytes!(#path); But this can not be done for the tileset, because the macro do not know where they are stored. let mut tileset = quote!();
for path in glob("./**/*.tsx").unwrap() {
let path = path.unwrap().canonicalize().unwrap();
let path = path.to_str().unwrap();
tileset = quote! {
#tileset;
const _: &[u8] = ::core::include_bytes!(#path)
}
} |
Have you considered using a build script insead to convert your maps? You can select when to rerun it, and you won't need any macro usage in your app code. |
I personal prefer using macros, because you can easier see, where the generated code is included. A build script instead does write in some "random" files and is run every time if I compile something. However the current workaround does work for me. |
After refactoring my sokoban clone I had the same issue here. I've thought about it once again and I don't see much issue in adding a source member that just stores the path that the |
@aleokdev Yeah, feel free to just add it! |
Done in #303. Will close on next release |
I would like to get the path of the tileset used at the map.
But it does look like Tileset does not provide this option.
The text was updated successfully, but these errors were encountered: