Commit Graph

40 Commits

Author SHA1 Message Date
Lukas Klingsbo
bde4585fa0 Collision detection (#633)
* Move out collision detection methods

* Add possibility to define a hull for PositionComponents

* Add example of how to use hull with tapable

* Update contains point comment

* Fix contains point

* Hull should be based on center position

* Remove collision detection parts

* Use percentage of size instead of absolute size

* Separate hull from PositionComponent

* Clarify hull example

* Fix formatting

* Change to relative import

* Use mixin for hitbox

* Update changelog

* Rename HasHitbox to Hitbox

* Clarified names

* Add spaces within braces

* Removed extra spaces in the braces

* Moved point rotation to Vector2 extension

* Render hitbox within extension

* Added collision detection

* Add tests

* Separate classes into files

* Fix formatting

* Move geometry files into geometry directory

* Use relative import for mixin

* Begin intersections between different shapes

* Add shape class

* Align with rebase

* Fix CHANGELOG

* Fix children positioning

* New polygon intersection algorithm

* No anchor for shape in PoC

* Remove unused imports

* Smarter bounding rectangle comparisons

* Formatting

* Add Circle to Circle collision

* Circle-polygon intersections

* Explanation of circle-circle intersections

* Properly render circle circle collisions

* Fix formatting

* Better example

* Update docs for collision detection

* Fix formatting

* Add polygon definition example

* Update documentation about the shapes

* Moved premature rc6 changelog line

* Added a cache system for shape calculations

* Fix formatting

* Fix formatting

* Fix imports

* Add collidable polygon to example

* Use anchorPosition for PositionComponent containsPoint

* Fix angle problem for Rectangle

* collisionCallback -> onCollision

* Fixed Erick's comments

* Improve collision detection example

* Fix #662, zero size doesn't contain any points

* Fix formatting

* Can't contain point if x or y is 0

* Fix formatting

* Fix test

* Remove unnecessary collidable example part

* Align with Draggable overhaul

* Updated collision detection docs

* Fix PR comments

* Have more sensible Circle constructor

* Clarify shape fields

* Need ensureInitialized

* Update docs to conform with switched constructors

* Fix new definitions

* Fix formatting

* Update documentation

* Fix formatting

* Fix formatting

* Exclude metrics check for test files

* Add another simpler example of collision detection

* Updated according to comments

* Fix comments

* Fix more comments

* Fix more comments

* Fix relative import

* Fix comments

* Moved export of geometry

* Fix comments

* Remove unused import

* Fix assert for shape.component

* Fix comments

* Expect instead of assert in test
2021-02-22 00:44:11 +01:00
Erick
19ff80a0eb Adds checking for trailling commas on the project (#670)
* Testing a new linter option for trailling commas

* Checking trailling commas on linter
2021-02-18 11:31:45 -03:00
Luan Nico
12cafb1da3 Draggables Overhaul (#660) 2021-02-15 14:06:35 -05:00
Lukas Klingsbo
0593e35766 Add hitbox to PositionComponent (#618)
* Move out collision detection methods

* Add possibility to define a hull for PositionComponents

* Add example of how to use hull with tapable

* Update contains point comment

* Fix contains point

* Hull should be based on center position

* Remove collision detection parts

* Added tests

* Use percentage of size instead of absolute size

* Separate hull from PositionComponent

* Clarify hull example

* Fix formatting

* Override correct method

* Use mixin for hitbox

* Update changelog

* Rename HasHitbox to Hitbox

* Clarified names

* Center to edge is considered as 1.0

* Fix test

* Add spaces within braces

* Removed extra spaces in the braces

* Add hitbox docs

* Fix link

* Moved point rotation to Vector2 extension

* Render hitbox within extension

* Fix rebase

* Fix rebase

* Fix formatting
2021-01-20 23:39:01 +01:00
Renan
ccee9a466b Move files to src and comply with the dart package layout convention (#621)
* 👌 Use `Offset` type directly in `JoystickAction.update` calculations (#631)

* Move files to src and comply with the dart package layout convention

* Fixing widgets example

Co-authored-by: Serge Matveenko <lig@countzero.co>
Co-authored-by: Erick Zanardo <erickzanardoo@gmail.com>
2021-01-20 09:05:43 -03:00
Serge Matveenko
16eaef3bb1 🏷 Backport some code improvements from the null-safety branch (#603) 2021-01-08 23:25:29 -03:00
Lukas Klingsbo
692213d5a4 Properly propagate onMount and onRemove to children (#579)
* Fix rendering of children

* Game loop handles other restore

* Properly propagate onMount and onRemove to children

* Use BaseGame on gestures to minimize confusion

* Fix linting

* All children don't need preparation

* Add composability example

* gameRef might not be defined

* Add mustCallSuper

* isMounted on game

* Remove unused gameRef argument

* Made isMounted only modifiable by the component

* Move dartdoc to public isMounted

* Fix formatting
2020-12-21 12:42:45 +01:00
Lukas Klingsbo
bd8257402b Rename Dragable -> Draggable (#575)
* Rename Dragable -> Draggable

* Hide ambigious class

* Add changelog entry

* Update docs
2020-12-19 01:10:17 +01:00
Lukas Klingsbo
2291002066 Update docs to take margin/padding into account 2020-12-09 10:22:36 +00:00
Lukas Klingsbo
598436a3cb isDragged -> isDragging 2020-12-09 10:22:36 +00:00
Lukas Klingsbo
463c30c374 Support dragable components 2020-12-09 10:22:36 +00:00
Renan
2f2ab1341e game widget (#533) 2020-12-09 10:10:12 +00:00
Lukas Klingsbo
98ad12d269 Use relative imports 2020-12-09 10:10:12 +00:00
Lukas Klingsbo
46554507a7 Tapables need to be handled in reversed priority order 2020-12-09 10:10:11 +00:00
Lukas Klingsbo
8665172ed9 Take angle into account for taps 2020-12-09 10:10:11 +00:00
Lukas Klingsbo
d09d2bd449 Add TextBoxConfig options and fix TextBoxComponent bugs (#534)
* Add TextBoxConfig options and fix TextBxoComponent bugs

* Add changelog entry

* Fix snackbar deprecation

* All examples to have publish to none

* One argument per line

* No explicit types for local variables

* Cache the width

* Fix formatting
2020-12-09 10:07:35 +00:00
Luan Nico
37ad12e9a0 . 2020-10-14 22:41:51 -04:00
Lukas Klingsbo
0f9fc2c60e Fixed with regards to the comments 2020-09-30 20:49:19 +02:00
Lukas Klingsbo
f97f20ab73 Vector2 for position and size on PositionComponent 2020-09-30 19:12:52 +02:00
Luan Nico
9d9d94c1b3 Fix examples dart version to allow extensions 2020-09-27 15:28:44 -04:00
Luan Nico
3c48aa345d Fixes 2020-09-27 15:15:58 -04:00
Luan Nico
a6023f4cfe Fixes 2020-09-27 15:10:42 -04:00
Luan Nico
63ad21d421 Fix usages 2020-09-27 14:52:05 -04:00
Erick Zanardo
bb30058642 Merge branch 'develop' into v1.0.0 2020-09-27 15:22:45 -03:00
Benjamin Gudehus
25b0f403f7 Adding ScrollDetector 2020-09-14 22:38:25 +02:00
Erick Zanardo
15d9210b72 More lints fixes 2020-09-12 11:54:53 -03:00
Erick Zanardo
a35c2e397c Updating changelog and fixing format 2020-09-12 11:50:30 -03:00
Erick Zanardo
3e4143a7ac Updating with PR suggestions 2020-09-12 11:47:32 -03:00
Erick Zanardo
a4613f7be3 linting 2020-09-10 22:39:11 -03:00
Erick Zanardo
0d8c0b7b6c Adding HoverDetector 2020-09-10 22:33:51 -03:00
Luan Nico
01b3863353 address comments 2020-08-18 23:39:40 -04:00
Luan Nico
1da1d4bb98 fixes 2020-08-08 19:54:12 -04:00
Luan Nico
6f836ee36c Extract each component to their own file 2020-08-03 13:08:41 -04:00
Erick Zanardo
b46ebb1378 Linting 2020-05-20 19:57:48 -03:00
Erick Zanardo
624a4de294 Refactoring gestures to fix conflicts 2020-05-20 19:55:36 -03:00
Erick Zanardo
df1f88a6e0 Reverting doc rename 2020-05-18 15:13:22 -03:00
Lukas Klingsbo
9293a6e4a9 Renamed doc to docs and minor language fixes 2020-05-10 16:51:49 +02:00
Erick Zanardo
dea71c98f3 Changing docs to reflect the refactoring 2019-11-11 09:24:13 -03:00
Erick Zanardo
a2336b926d Refactoring new API to use mixins 2019-11-11 09:24:13 -03:00
Erick Zanardo
6f44e0514b Fixing gestures conflicts and adding a gestures example 2019-11-11 09:24:13 -03:00