flame
flame copied to clipboard
Use `drawAtlas` for Particles
What could be improved
We should investigate whether drawAtlas can now be used for particles.
Why should this be improved
It should be insanely much more efficient.
Any risks?
That it might not work properly on all platforms: https://github.com/flutter/flutter/issues/88220
More information
Feel free to use my PRs to the simple_animations package as an inspiration: https://github.com/felixblaschke/simple_animations/pulls?q=is%3Apr+author%3Ayjbanov+is%3Aclosed
I believe https://github.com/flutter/flutter/issues/88220 shouldn't affect your use-case. That issue seems to be caused by our lack of targetWidth and targetHeight support in image Codec. However, particles can be created from pictures at desired resolution like this, i.e. there's nothing to decode.
@spydon We use drawAtlas in Tiled via sprite batching: https://github.com/flame-engine/flame/blob/6fe517a0c20ac2508539f26766fc0f3c0f7a2ac2/packages/flame/lib/src/sprite_batch.dart#L366-L374
@spydon We use drawAtlas in Tiled via sprite batching: https://github.com/flame-engine/flame/blob/6fe517a0c20ac2508539f26766fc0f3c0f7a2ac2/packages/flame/lib/src/sprite_batch.dart#L366-L374
Yep I know :)