-
-
Notifications
You must be signed in to change notification settings - Fork 908
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
feat: Support for new atlas format and rotated sprites #3097
feat: Support for new atlas format and rotated sprites #3097
Conversation
…iginalWidth, originalHeight, degrees, rotate, index. So we set the defaults in code
bb3f6c6
to
5f48e6d
Compare
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.
Looks good, just a few small comments
flame_texturepacker: | ||
path: ../ |
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.
This should not be modified, Melos keeps track of this through the pubspec_overrides.yaml file
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.
Got it. I removed the commit
@@ -297,3 +296,14 @@ extension _IteratorExtension on Iterator<String> { | |||
return null; | |||
} | |||
} | |||
|
|||
extension _IterableExtension<T> on Iterable<T> { | |||
T? firstWhereOrNull(bool Function(T element) test) { |
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.
This is already built-in to collection:
https://api.flutter.dev/flutter/package-collection_collection/IterableExtension/firstWhereOrNull.html
So just import collection instead, since we use that everywhere else.
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.
Got it. I updated the code to use the build-in collection
) { | ||
_decorator = Transform2DDecorator(_transform); | ||
if (region.rotate) { | ||
_transform.angle = radians(90); |
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.
_transform.angle = radians(90); | |
_transform.angle = math.pi / 2; |
_transform.angle = radians(90); | |
_transform.angle = tau / 4; |
We should limit the use of degrees as much as possible.
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.
Got it. Code updated
static final _tmpRenderSize = Vector2.zero(); | ||
|
||
@override | ||
void render( |
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.
Sound all this be skipped if there is no rotation set?
So that super.render
is called if there is no rotation, since that should be more performant?
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.
This is a good idea. I updated the code
5f48e6d
to
b731530
Compare
b731530
to
5449f1a
Compare
5449f1a
to
55286c2
Compare
@spydon Hello. I have updated/replied to the comments. Please take a look when you have some time. |
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.
Lgtm!
@spydon There is a broken test case. But the code is not related to this pull request. Can you take a look? |
It was the annoying flaky test that was acting up again, re-ran it and now the PR is merged. :) |
Description
Added support to load new atlas format and support for rotated sprites
Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?
Related Issues