This PR is the second in a series of refactors that aim to simplify event handling in Flame. The approach is as follows:
Added the MultiTapDispatcher component, which contains the logic that used to be within the HasTappableComponents mixin. This component is internal; it mounts to a FlameGame directly, and ensures that it is a singleton.
Whenever any TapCallbacks component is added to a game, it automatically adds the MultiTapDispatcher component (unless there is already one), which in turn registers a tap gesture detector with GestureDetectorBuilder and rebuilds the game widget.
The end result is that now in order to make a component tappable you only need to add the TapCallbacks mixin to that component, everything else will be handled by the framework.
Consequently, the HasTappableComponents mixin is now empty and marked as deprecated.
* `ShapeComponent` changes size, position and angle of underlying Shape
* Added description to ShapeComponent
* Fix test
* Update packages/flame/lib/src/components/shape_component.dart
Co-authored-by: Erick <erickzanardoo@gmail.com>
* Add absoluteScale and absoluteAngle to PositionComponent
* Refactor ShapeComponent
* Should be scaled by total scale, not scaled size
* Premature optimization for creation for objects in Polygon
* Use path for default Polygon constructor
* Do not sync component and hitbox shape
* Fix analyze issue
* Add example for flipping with collision detection
* Don't use absoluteScale
* Fix examples
* Fix examples
* Doesn't need super.render
* Fix Circle dartdoc
* Update changelog
* Update names of vertices caches in Polygon
* Update text docs
* Revert "Update text docs"
This reverts commit 73a68a465d76eb0eb50bb3753e57b2f4e3b5a7f4.
* Fix examples
* ShapeComponents docs
* Move example games to the top
* Fix dartdoc comment about polygon vertex relation
* Fix order of polygon vertices in dartdoc
* Fix anchor for PolygonComponent.fromPoints
* Add test with ancestors
* Update doc/components.md
Co-authored-by: Pasha Stetsenko <stpasha@google.com>
* Update doc/components.md
Co-authored-by: Erick <erickzanardoo@gmail.com>
* Rename example classes
* Fix linting issues in examples
* Don't use px
* Use isTrue and isFalse
* Update doc/components.md
Co-authored-by: Erick <erickzanardoo@gmail.com>
* Fixed comments on PR
Co-authored-by: Erick <erickzanardoo@gmail.com>
Co-authored-by: Pasha Stetsenko <stpasha@google.com>
* Simplified the usage of ShapeComponent
* Default constructor for _RandomCircle
* Use default constructor
* Forced Anchor.center on ShapeComponent
* Fix examples using SquareComponent
* Removed unnecesary import
* Renamed edgeLength to size
* Added FlameAnimationController class
* Added MainAnimationController class
* Update doc comments
* formatting
* rename MainAnimationController
* Added tests for StandardAnimationController
* Added more tests
* comment
* Added changelog note
* Export StandardAnimationController
* formatting
* Use a default for 'curve' parameter
* rename onsetDelay -> startDelay
* Added Transofm2DEffect
* Added EffectComponent
* Added .transform getter
* formatting
* Rename EffectComponent -> Effect
* Add documentation for the Effect class
* minor
* Added a test for Effect class
* Adding tests for removeOnFinish
* Adding tests for onStart and onFinish
* Also check the effect after reset
* Fix-up merge
* formatting
* added doc-comments
* changelog note
* Added test for transform2DEffect
* Adjusted comments
* Make PositionComponent._transform public
* change changelog
* Added SimpleEffectController
* Added DestroyEffect
* Changelog note
* Rename DestroyEffect -> RemoveEffect
* Added example for RemoveEffect
* flutter format
* Move description of the RemoveEffectExample game
* move the description again
* minor