21 Commits

Author SHA1 Message Date
cb52f5a58a docs: MotorJoint doc and example (#2394)
Documentation covering MotorJoint and a usage example.
2023-03-12 22:31:20 +00:00
0ea612d73a docs: FrictionJoint documentation and example (#2383)
Added documentation and example for FrictionJoint.
Also modified main.dart to be able to run individual examples by providing page param.
2023-03-06 23:34:45 +01:00
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
3a73d1456c feat: Lottie bridge package (#2157)
This PR adds support for Lottie animations to flame
2022-11-22 21:42:15 +00:00
b25b935644 feat: FlameIsolate - a neat way of handling threads (#1909)
Adding a bridge library for integral_isolates adding support for components to run CPU intensive code with a function similar to Flutter's compute function, but with a long lived isolate. Lifecycle is handled by the game loop, where the isolate would live between onMount and onRemove.
2022-10-31 21:06:27 +01:00
6410dc753c feat: Animated tile support! (#1930)
Tiled supports animated tiles, and now Flame does as well...
2022-09-23 16:55:15 +02:00
d6bf920d28 feat!: Update flame_audio to AP 1.0.0 (#1724) 2022-06-14 00:12:47 -04:00
c34456b3f2 chore: Fix some of the remaining lint problems (#1706)
Fix warnings raised by the avoid_void_async lint rule;

Remove rule use_enums, which is not available in Dart 2.16
2022-06-07 07:33:04 +02: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
f88200a1bf docs: Added the T-Rex example (#1602) 2022-05-08 20:07:33 +00:00
6dd0a970e6 docs: Move flame_forge2d examples to main examples (#1588) 2022-05-01 13:00:48 +00:00
666a2b199f feat: Adding classes for raw geometric shapes (#1528) 2022-04-27 17:39:50 +00:00
c92432895d feat: adding svg example (#1352) 2022-02-11 10:13:30 -03: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
b8ea25eceb Fixing Flame pause and resume engine features (#1066)
* Fixing Flame pause and resume engine features

* Update packages/flame/lib/src/game/mixins/game.dart

* Apply suggestions from code review

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

* Update doc/game.md

* Update doc/game.md

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2021-11-02 23:08:53 +00:00
a1b6ffa04a Game as a Component (#906)
* Game as a component

* Fix component stories

* Effects are now components

* Update effects docs

* Handle swap of parent

* Fix reAddChildren

* Wait for children to be added

* BaseComponent and PositionComponent to be non-abstract

* Simplify HasGameRef

* Revert so that onLoad can be null

* Fix example description

* Effects as components

* Remove gameRef from addChildren

* Fix hasGameRef

* Start migrating effects

* Updated comments of effect fields

* Fix comments

* Continue to fix sequence and combined effects

* Upgrade ordered_set

* Fix position_component_test

* BaseComponent -> Component

* Fix combined and sequence effects

* Await components to be added in tests

* Remove unnecessary game.update in tests

* Fix some tests related to composition

* BaseGame should be used in examples

* Fix CombinedEffect test

* Keyboard code to be based on Component

* Fix keyboard tests

* Fix analyze problems

* Fix sequence_effect

* Fix combined_effect_test

* Store peak state instead of end state

* Fix sequence_effect tests

* Update tutorial

* Fix tutorial 1

* Remove SimplePositionComponentEffect

* Remove unused test variable

* Update docs

* Removed onMount

* Remove onMount

* Add missing dartdoc

* Fix dart docs

* Add super.update where needed

* Move reAddChildren to component

* Reorganize method order in game widget

* preOffset -> initialDelay, postOffset -> peakDelay

* Introduce component.onParentChange

* Remove tests in wrong file

* Fix composed component test

* Add game lifecycle test

* Use BaseGame for mouse cursor test

* Oxygen should (?) not call super.update

* Use BaseGame in keyboard_test

* Fix onLoad to be properly cached

* Re-add unintentionally removed override

* Fix info for collision detection tests

* Add test for correct lifecycle on parent change

* Fix particles example

* Add component lifecycle diagram to the docs

* Add docs for the game lifecycle

* onRemove should be called when a game is removed from the widget

* Fix analyze errors

* prepare should be called from the component itself, not its parent

* Fix dartdoc

* onParentChange -> onMount

* onMount should have void as return type

* Simplify the loaderFuture in GameWidget

* Fix mock_canvas

* Fix rebase problem

* Remove asComponent

* Less complex _loaderFuture

* Add super.update to no_fcs parallax example

* Fix async tests

* Revert _loaderFuture

* Fix analyze issues

* await gameWithCollidables

* Keep epsilon small where it can be

* tappable methods should return bool

* Game lifecycle is now the same as for Component

* Remove mustCallSuper from component.update

* Make onLoadCache protected

* @internal on onLoadCache

* Cache/Memoize debugPaint and debugTextPaint

* Fix imports

* Fix comments

* Always call super.onLoad so that mixins can override it

* Add forgotten super.onLoad

* Bump coverage percentage

* HasCollidables should override update

* Fix Game comments

* Fix some dartdoc

* Apply suggestions from code review

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

* Game + Loadable as mixins

* Update packages/flame/lib/src/game/game_widget/game_widget.dart

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

* Update loadable docs

* Fix comments

* Move fps_counter

* Fix keyboard example

* Fix dartdoc

* Remove tutorials temporarily

* Fix game lowlevel graph

* Fix resize issue

Co-authored-by: Erick <erickzanardoo@gmail.com>
Co-authored-by: Luan Nico <luanpotter27@gmail.com>
2021-09-15 00:17:49 +02:00
64a40ff641 Refactor joystick (#876)
* Refactor joystick

* Fix directional tests

* Joystick example

* Any PositionComponent can be used as knob and background

* Add MarginButtonComponent

* Fix JoystickExample

* Update joystick docs

* Fix joystick direction tests

* Fix effect tests

* Fix analyze issue

* Update docs

* Update docs

* Move joystick to input export

* Update packages/flame/lib/src/geometry/shape.dart

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

* Add test and description for screenAngle

* Update examples/lib/stories/controls/joystick_player.dart

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

* Update doc/input.md

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

* controls -> input in examples to align with export file

* controls -> input

* Add simple joystick example

* Fix imports

* velocity -> relativeDelta

Co-authored-by: Luan Nico <luanpotter27@gmail.com>
Co-authored-by: Erick <erickzanardoo@gmail.com>
2021-07-15 12:00:41 +02:00
380781e126 Adding Builder classes for our widgets catalog (#853)
* Add

* Adding SpriteWidgetBuilder

* Adding SpriteButtonBuilder

* Add NineTileBoxBuilder

* a few adjustments on the docs

* Adding error and loading builders to the widgets

* Improving APIs for the widget review

Co-authored-by: Luan Nico <luanpotter27@gmail.com>
2021-07-13 17:36:13 -03:00
91864d0b88 Making velocities and deltas have the game and global values (#769)
* Making velocities and deltas have the game and global values

* Re adding code metircs

* Re adding code metircs

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

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

* Renaming example variable

* fixing example

* Linting

Co-authored-by: Luan Nico <luanpotter27@gmail.com>
2021-04-25 14:54:04 -03:00
1091f441ac Bring back collision detection example (#736) 2021-04-05 13:33:12 +02:00
769bb711c3 Migrate examples back, change to monorepo (#701) 2021-03-12 09:24:50 -05:00