Giter Club home page Giter Club logo

Comments (8)

raimundomartins avatar raimundomartins commented on June 22, 2024 1

What do you mean by this? I don't understand.

I was just explaining why I wouldn't use it. It's not important.

What's important is your last suggestion which is actually pretty cool! That I would definitely use!

from rs-tiled.

bjorn avatar bjorn commented on June 22, 2024

In the bevy_ecs_tilemap crate, somebody introduced a BytesResourceReader, see StarArawn/bevy_ecs_tilemap#425. Does that help or would you still suggest we should add back load_tmx_map_from?

from rs-tiled.

raimundomartins avatar raimundomartins commented on June 22, 2024

Huh, I guess I should've gone to the main branch before posting this. That along with what's in #265 is a good enough solution to me. I still don't see why the helper method had to go, but at least there's a reasonable alternative. Thanks!

from rs-tiled.

aleokdev avatar aleokdev commented on June 22, 2024

I still don't see why the helper method had to go, but at least there's a reasonable alternative. Thanks!

load_..._from was a hacky method to only load completely embedded maps from some source. That is still possible in 0.11, it's just a bit more manual work. Perhaps we could add it back as the BytesResourceReader solution.

from rs-tiled.

raimundomartins avatar raimundomartins commented on June 22, 2024

Personally, it wouldn't do much good unless it would support supplying another ResourceReader for the remainder of files. I know I asked how I could use it with the FilesystemResourceReader, but since I can easily use a more portable solution from the beginning, I prefer portability.

from rs-tiled.

aleokdev avatar aleokdev commented on June 22, 2024

Personally, it wouldn't do much good unless it would support supplying another ResourceReader for the remainder of files.

Yeah, that's something load_tmx_map_from could not do and it may be useful to have.

I know I asked how I could use it with the FilesystemResourceReader, but since I can easily use a more portable solution from the beginning, I prefer portability.

What do you mean by this? I don't understand.

Now that I think about it, we could implement ResourceReader for anything that implements for<'a> Fn(&'a Path) -> Result<R, E> where R: Read, E: Error + Send + Sync + 'static, which would allow easily defining a ResourceReader inline in the Loader declaration, removing a lot of boilerplate and simplifying the process altogether, something like this:

let mut loader = Loader::with_cache_and_reader(
    DefaultResourceCache,
    |path| { if path == "my-map.tmx" { Ok(that_map) } else { Err(MapLoadingError) }
);

What do you think about this?

from rs-tiled.

aleokdev avatar aleokdev commented on June 22, 2024

Thanks :) I'll try to PR it whenever possible. I'm currently really busy with exams so it probably won't be done until ~2weeks from now.

from rs-tiled.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.