5 Commits

Author SHA1 Message Date
4f5e56f05f feat: Added AlignComponent layout component (#2350)
This PR adds first layout component: AlignComponent, an equivalent of Align widget in Flutter.

AlignComponent sizes itself to its parent, and then keeps its child aligned to the specified anchor within its own bounding box.

Also adding onParentResize() lifecycle method, which is similar to onGameResize, but fires whenever the parent of the current component changes its size for any reason. (FlameGame is assumed to have the size canvasSize, and will invoke onParentResize whenever the canvas size changes).

Additional layout components are planned to be added in future PRs.
2023-03-02 22:51:02 +01:00
843ddc3624 refactor: Move to package imports (#1625)
* refactor: Move to package imports

* Fix local imports

* Removed unused imports
2022-05-15 15:04:35 +00:00
c753fc4636 feat: Components are now always added in the correct order (#1337)
* wip o lifecycle

* Component.add() is no longer async

* fix a test

* game.ready

* fix analyze issues

* FcsRoot

* fix tests

* fix game-in-game example

* Merge _addImpl with add()

* Move some of the functionality from prepare() into add()

* Moved FcsRoot into component.dart and renamed

* more doc-comments

* dartdocs

* Remove addLater in ComponentSet

* format

* temporarily switch to path dependency in flame_test

* restore a test

* format

* get rid of prepare() in Collidable

* eliminate prepare() in Draggable

* eradicate prepare() in Hoverable

* remove prepare() from Tappable

* remove prepare() method and isPrepared flag

* remove prepareComponent() from HasCollidables

* remove prepareComponent

* make flame_bloc depend on latest flame

* try to solve flame_bloc dependency graph

* fix game resize issue

* fix gameresize for zoomed game

* do not allow zero size in onGameResize

* move onMount() call into add()

* use loadingBuilder when size is 0

* ComponentTreeRoot is now in its own file

* addToParent()

* switch to mount queue

* rename isReadyToMount -> isPrepared

* make isMounted and isPrepared readonly

* minor

* print error stacktrace

* Component.add() is now async

* fix tests

* unused import
;

* undo irrelevant changes in Component

* update tests

* tests cleanup

* format

* expand doc for ComponentTreeRoot

* fix analysis error

* added tests

* update docs

* resolve version conflict in pubspec

* Apply suggestions from code review

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

* late final

* remount() function

* remove mountQueue

* simplify ready()

* run mount during children queue processing

* simplify mounting

* rename childrenQueue->childreQueues

* merge tryMounting() with remount()

* avoid statics in components lifecycle

* remove ComponentTreeRoot

* remove dead code

* added a todo

* added docs for SingleGameInstance

* Added tests for SingleGameInstance

* added SingleGameInstance to the main doc site

* Added test for multi-widget games

* cleanup

* use state variable in Component

* remove test as dependency

* upgrade mocktail version

* upgrade dartdoc version

* fix analyzer warnings

* mark staticgameinstance as internal

* remove ComponentSet.addChild

* use log() from dart:developer

* undo changes in flame_bloc/pubspec.yaml

* redo changes in flame_bloc/pubspec.yaml

* fix dependency in flame_test

* remove test dependencies

* update pubspec files

* remove dart_code_metrics from pubspec

* fix a test

* Added GameTester.makeReady

* omit type on class variable when it can be inferred

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

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Co-authored-by: Erick <erickzanardoo@gmail.com>
2022-02-14 23:22:44 +01:00
05f7a4c3d6 refactor: Remove Loadable, optional onLoads (#1333) 2022-01-24 23:23:12 +01:00
8b132d7c0b Unify examples structure (#1118)
* Animations, CameraAndViewport, CollisionDetection and Components unified

* Added descriptions to effects

* Rename input games

* Unify input stories

* Add info to parallax section

* Added descriptions to the rendering examples

* Add descriptions to the sprites directory

* Fix utils and rendering section

* Add descriptions to the widgets section

* Delete directory that rebase brought back

* Unify game names

* Added some styleguide docs for examples

* Fix analyze issues

* All files should have _example as suffix

* Made the FollowComponentExample a bit easier to understand

* Change priority of ember
2021-11-19 14:28:04 +01:00