-
-
Notifications
You must be signed in to change notification settings - Fork 32
feat: TsxProviderBase with test function #72
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
base: main
Are you sure you want to change the base?
Conversation
|
I've got some questions about the checklist:
|
Super!
The checklist is copied from Flame, you can create an example directory if we don't have one (shame on us 😅). |
I would consider just breaking current implementations, as long as you are willing to write a PR for Overall it's hard to me to tell if this PR makes sense without concrete examples, maybe tests would help with that |
ufrshubham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't seem to understand why TsxProviderBase had to be a separate class. If it is just to avoid breaking filename getter, then I think making that breaking change should be fine.
|
@benni-tec any updates on this? :) |
|
Not yet. My fork currently does everything I need for my current project. I do plan to submit proper PRs for this and the other issues I've opened, however I am currently pretty time constrained. As of now my current project should be wrapped up in January, I am currently planning to clean up and submit PRs then. Is this something that is time-sensitive for you? If so I will see if can get the PRs done this year! |
spydon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments, over all it looks good :)
|
LFTM (looks fine to me!) |
|
Thanks for the review, I didn't have to time yet to write a proper comment: I have generalised into a generic Provider that can also be used for templates, therby also resolving #73, also as being extensible to more easily discover the location of images in I also moved the methods from TileMapParser into TiledMap since there were already parsing method there, and I always thought it was confusing to have this in a different class that does nothing otherwise. While moving it over I also made the names nicer and more descriptive. The I took the liberty of adding the Lists of However I split them into multiple Lists so one for tmx and one for templates. This however does not allow to integrate the same mechanism for images (e.g. of tilesets), because I don't think the actual loading of the images is supposed to be in this library and nothing is ever done with them I don't think that is a big deal. However I could also only pass one List and the |
|
Sorry for the extremely late reply @benni-tec, I had completely forgotten that we had open PRs on this repository! |
|
Honestly I also forget about the PRs since my project was finished in January, I just merged the incoming changes into #77 and it should be ready to merge now. I will merge theses changes here as well and incorporate the feedback today, this PR should then also make #59 obsolete. As for #78 I believe you said it should be an extension package, however I beliebe I made some adjustments in that PR that should be merged to, I will have to look at it again |
7ec1e65 to
7d30da8
Compare
|
Alright so I rebased this branch onto #77 and fixed the docs as well as incorporating the feedback here. The tests also clear now, as for the analyze it failed due to the partof directives so I'm gussing thats fine? And I don't know whats up with format |
7d30da8 to
9309a78
Compare
--> replaced dart:ui Color with color_model package --> custom Rect instead of dart:ui --> replaced flutter_test with test package
…ontracts // corrected and extended README.md
553a9ad to
80d0901
Compare
|
@benni-tec could you do a final check on the PR just to see that everything looks correct after the rebase? :) |
|
Ping @benni-tec, I think this is pretty much ready to merge right? |
# Conflicts: # README.md # packages/tiled/lib/src/tsx_provider.dart # packages/tiled/pubspec.yaml
|
Hi everybody, I kept this discussion in my inbox (and the back of my mind) but never got around to checking-in again, sorry! I just had a look and I believe it is indeed ready to be merged, the only thing that is missing is the appropriate PR for If you are still interested in this I will try to get it done before the new year. P.S.: I will be closing the export PR and try to move the code to a new repository. That is indeed a lot of code and potentially a huge maintanence burden |
|
While integrating this into Flame I discovered a new problem: Loading from the bundle is asynchronous. Therefore either the provider and thus the parsing needs to be asynchronous or we hack it in If the provider and therefore the parser should stay synchronouse (which is a valid point IMO), then the |
|
@benni-tec sounds good, go for it. :) |
|
What would you prefer:
|
Description
Currently a
TsxProviderneeds a getter for the filename it can provider. This PR seeks to introduce a new base classTsxProviderBasewhich instead uses abool checkProvidable(String filename)function to determine if aTsxProviderBaseis able to provide the source.To accomplish this it also has
Parser getSourceBase(String filename)andParser? getCachedSourceBase(String filename)methods to retrieve the source when needed.While do not like attaching Base to everything this naming scheme seems to be the easiest option to not break current implementations.
This new functionality is usefull for example to resolve all .tsx-files relative to a single directory.
Checklist
fix:,feat:,docs:etc).docsand added dartdoc comments with///.examples.Breaking Change
While the internal functionig does change and new APIs are exposed I have recreated the old behaviour in
TsxProvideras a sub class of the newTsxProviderBase. Therefore classes extendingTsxProvidershould work as before with no breaking changes.However classes only implementing it will require additional methods, however if only implemented they should directly implement
TsxProviderBasesince (apart from the implementation of the old behaviour)TsxProviderdoes not offer more functionality. It is simply a Wrapper to emulate the old behaviour and not break convention.Migration instructions
All classes only implementing
TsxProvidershould eitherTsxProviderif the old API is needed (this allows you to not have to look at any new functionality) orTsxProviderBase.Related Issues
Completes #70
Allows for usecase described in #69