7 Commits

Author SHA1 Message Date
948f277e5d Fix gestures when isHud = true and camera is transformed (#843)
* Fix gestures when isHud = true and camera is transformed

* Use Info instead of Event everywhere
2021-06-09 23:47:59 +02:00
a7fd05f2b5 Make game.size take zoom into consideration (#836)
* Make game.size take zoom into consideration

* Fix formatting

* Fix formatting

* Apply suggestions from code review

Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>

* Move _sizeBuffer

* Apply suggestions from code review

Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>

* Update list from wolfenrains suggestion

* Fix formatting

* Update CHANGELOG.md

Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>
2021-06-09 16:39:45 +02:00
e4281d6471 onCollisionEnd callbacks for Collidable and HitboxShape (#792)
* Add onCollisionEnd for HitboxShape and Collidable

* Add tests for collision callbacks

* Detect multiple collsions with same collidable in test

* Remove unused import

* Break out duplicated code

* Fix formatting

* Use correct hash set

* Update examples/lib/stories/collision_detection/multiple_shapes.dart

Co-authored-by: Erick <erickzanardoo@gmail.com>

* Update examples/lib/stories/collision_detection/multiple_shapes.dart

Co-authored-by: Erick <erickzanardoo@gmail.com>

* Use hashValues instead of _combineHashCodes

* hashValues is order dependent so we need to sort the objects first

* Add section about onCollisionEnd

* Fix missed hashValues

* Use xor instead of hashValues

* Update examples/lib/stories/collision_detection/collision_detection.dart

Co-authored-by: Luan Nico <luanpotter27@gmail.com>

Co-authored-by: Erick <erickzanardoo@gmail.com>
Co-authored-by: Luan Nico <luanpotter27@gmail.com>
2021-05-18 16:21:49 +02:00
6d17424c13 Fix collision detection and rendering of local shape angles (#773)
* Fix collision detection with anchor other than center

* Fix rotation around anchor

* Simplify advanced collision detection example

* Add some tests

* Simplify multiple shapes example more

* Move shapeCenter logic into Shape

* Render center point

* More debugging in MultipleShapes

* Wtf.

* Re-add "possibly" calculation

* Rotate shape around parent center

* Only consider the parent center

* Format multiple shapes example

* Add simple shapes example

* Add caching in polygon

* Fix rendering of polygon shapes

* Remove print

* Add changelog entry

* Fix analyze complaints

* Remove all shapes that contain the pressed point

* Take zoom into consideration in multiple shapes example

* Remove useless import

* map instead of generate

* Fix position component test

* Simpler negative vector2

* "Correct" format

* Add ShapeComponent instead of camera aware shapes

* Fix formatting

* Remove zoom from collision detection example

* No need for gameRef in MultipleShapes example

* Fix naming in only_shapes
2021-05-04 22:31:36 +02:00
d9e0acd3ff Abstracting text API to enable custom renderers (#772)
* Abstracting text API to enable custom renderers

* Addressing comments

* Lint

* Update doc/text.md

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>

* Adding dartdoc about TextRenderer

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2021-04-29 09:24:17 -03:00
6b2f8032fe Making Flame events aware of camera (#755)
* some initial refactoring

* Fixing examples and joystick component

* Fixing examples

* Addressing comments from PR

* Fixing tutorials

* Updating docs

* Fixing tests

* PR followup

* A big follow up

* linting

* doc nit

* Changelog and fix tutorial

* Addressing comments

* Fixing BaseGame project and scale offset methods

* Formatting

* doc suggestions

* Update packages/flame/lib/src/gestures/events.dart

Co-authored-by: Luan Nico <luanpotter27@gmail.com>

* Hopefully, the last follow up

* Linting and adding dart-code-metrics again

* fixing tutorial

Co-authored-by: Luan Nico <luanpotter27@gmail.com>
2021-04-15 15:28:46 -03:00
1091f441ac Bring back collision detection example (#736) 2021-04-05 13:33:12 +02:00