3302 Commits

Author SHA1 Message Date
781e898315 docs: Add more guidance to collision detection algorithm choices (#2624)
This is adding a bit more precise language and more context to API docs
of `HasCollisionDetection`, `Broadphase` and
`HasQuadTreeCollisionDetection`.
2023-07-26 14:42:57 +02:00
b4f6e271df chore: Bump audioplayers to 5.0.0 (#2621)
Bumps AP to 5.0.0
2023-07-24 13:05:27 +00:00
36e2b509b3 chore(deps): Bump pygments from 2.14.0 to 2.15.0 in /doc/_sphinx (#2620)
Bumps [pygments](https://github.com/pygments/pygments) from 2.14.0 to
2.15.0.
2023-07-24 12:40:00 +00:00
1cad0b23e1 feat: Add optional world input to CameraComponent.canSee (#2616)
CameraComponent.canSee wasn't performing any kind of sanity checks on the given components world or mounted-ness. This PR adds these checks to correctly return false if the component is not mounted or if the optional world is not the same as camera's current target world.
2023-07-21 23:12:26 +02:00
8e0a7879d7 perf: Improve performance of raycasts (#2617)
Creates an axis-aligned bounding box (AABB) around the ray to short-circuit checking.

In the general case, we skip ~75% of the checks because the ray originates at some point in the 2D cartesian space and goes towards infinity. The AABB in that case is a quadrant of space, and so only entities intersecting with this quadrant of space need to be checked.

In the case where the raycast is called with a maxDistance, the savings are much higher. A relatively short ray will generate a small AABB around its origin and end point. In a typical game world, there will be many entities that do not intersect with this AABB, and can be skipped.
2023-07-21 15:55:09 +02:00
14f5163542 feat!: Make world nullable in CameraComponent (#2615)
`CameraComponent` can now stare at nothingness because its world
reference can be null now.

### Migration instructions

`CameraComponent.world` is now nullable. While accessing it, make sure
to perform null checks if it can be null in your case. Otherwise, if you
are sure that the world is non-null perform unconditional using
`CameraComponent.world!`.
2023-07-19 21:38:02 +02:00
832c051085 fix: Only use pre-set ReadonlySizeProvider for sizing in HudMarginComponent (#2611)
In a project where we wrapped the `JoystickComponent` into it's own
`Component` to separate concerns resizing the window (or hot reloading)
would throw an exception leading to a red screen.

The `HudMarginComponent` currently expects the parent to be either a
`FlameGame` or `ReadOnlySizeProvider`, which throws an exception when
our wrapped `Joystick` class is neither.

With the help of @spydon, we came to the conclusion that this fix should
work and not break other cases.
2023-07-18 19:33:41 +02:00
346bb6c858 docs: Update Nakama link + add Supabase (#2608)
Update Nakama link + add Supabase to the docs.
2023-07-17 14:23:55 +00:00
8a9f87e131 docs: Adds more clarity to pub get (#2610)
Apparently someone thought they should run pub get in their terminal instead of flutter pub get. Though it's called "Pub: Get Packages" in the VS Code command pallete.
This changed pub get to flutter pub get in the installation guide (https://docs.flame-engine.org/latest/).
2023-07-17 09:42:34 +02:00
1567b38910 fix: TextBoxConfig dismissDelay to not be ignored (#2607)
`TextBoxConfig.dismissDelay` was being ignored, now it removed the
component once it is finished and the delay has passed, like intended.
2023-07-17 00:52:15 +02:00
a83f2815bb feat: Add a Circle.fromPoints utility method (#2603)
# Description

Add a `Circle.fromPoints` utility method to (maybe) create Circles that
intersect three given points.
2023-07-16 04:49:52 -04:00
1f9f35093b feat: Add a midpoint getter to LineSegment (#2605)
# Description

Add a `LineSegment.midpoint` utility getter.
2023-07-16 04:37:18 -04:00
76271ceef0 feat: Add Rectangle.fromLTWH and Rect.toFlameRectangle utility methods (#2604)
# Description

Add a `Rectangle.fromLTWH` and `Rect.toFlameRectangle` utility methods
to more easily create and convert between different rectangle
represenations.
2023-07-16 04:24:57 -04:00
c11fdb9940 chore(release): Publish flame v1.8.1 et. al (#2599)
- flame@1.8.1
 - flame_test@1.12.0
 - flame_audio@2.0.4
 - flame_bloc@1.10.0
 - flame_fire_atlas@1.3.7
 - flame_forge2d@0.14.1
 - flame_isolate@0.4.0+1
 - flame_lottie@0.2.1
 - flame_noise@0.1.1+3
 - flame_oxygen@0.1.8+4
 - flame_rive@1.9.0
 - flame_spine@0.1.1
 - flame_svg@1.8.0
 - flame_tiled@1.12.0
 - jenny@1.0.4
 - flame_network_assets@0.2.0+3
1.8.1 v1.8.1
2023-07-02 13:40:15 +00:00
a58d7436c9 feat: Option to prevent propagating collision events from ShapeHitbox to _hitboxParent (#2594)
See #2590 

Added `triggersParentCollision` variable to `ShapeHitbox` class to
prevent propogating `onCollision*` events to parent component
2023-07-02 13:19:38 +00:00
87139c8545 fix!: Convert PositionEvent.canvasPosition to local coordinates (#2598)
This PR makes the `PositionEvent` class take a `Game` instance as a
required parameter. The game is the used
to convert `canvasPosition` lazily as it is done in `EventPosition`.
As a result, i had to change several constructor calls to include the
game, and make a breaking change in the `flame_test` package for all the
`create[...]Events` functions. This may not be the best solution, but it
is the easiest. Feel free to share your opinion and improvement ideas.
2023-07-02 12:56:53 +00:00
985400f295 fix: Adds a check to confirm the component is not loaded (#2579)
This fixes https://github.com/flame-engine/flame/issues/2563 by
validating that a component is mounted and the child component is not
mounted before adding it to the queue.
2023-07-02 14:39:32 +02:00
ff3d91075c feat: Adding filterQuality arguments to Parallax load methods (#2596)
The Parallax already supported filter quality, but the loader methods were missing parameters for it to be passed to the loaded instances, making it impossible (unless manually loading) to set a filter quality in a parallax.

By setting a filter quality to none (which on flutter means that the next neighbour algorithm will be user) on pixel art sprites we can keep the crisp look that that style of art demands.
2023-06-30 06:03:00 +02:00
66d5f97d30 feat: Option to use toImageSync in ImageComposition class (#2593)
Added ImageComposition.composeSync() function
2023-06-29 22:22:33 +02:00
d40fefcf08 feat: TiledAtlas.clearCache function (#2592)
Possibility to clear TiledAtlas cache. This is required after Flame.images.clearCache() call.
2023-06-29 15:58:19 +02:00
45115bbff8 docs: Fix broken link on flame_forge2d readme (#2588) 2023-06-26 22:59:09 +02:00
b111007b8b docs: Update step3.md of Klondike tutorial to give Card isFaceDown (#2581)
Update step3.md of Klondike tutorial to give Card isFaceDown Since that property is used in step 4.
2023-06-25 15:51:33 +00:00
b3efb612cb feat: ComponentKey API (#2566)
Adds a new key api on FCS, which will allow users to get a component from the tree, without needing to iterate over all the children or a parent descendants.
2023-06-20 09:36:15 -03:00
667a169811 fix: Animation ticker readability improvements (#2578)
This PR marks SpriteAnimation.ticker() as deprecated with SpriteAnimation.createTicker() as a replacement. This is done to make it more clear that calling that method creates a new ticker. Also, the docs for SpriteAnimationGroupComponent are updated with code snippet showing how to access and use the callbacks from tickers of each animation state.
2023-06-17 14:46:13 +02:00
034edfb22b fix: Update step3.md to use correct constructor name (#2577)
In the tutorial, the code that relies on Rank uses the .fromInt constructor, not .of
2023-06-16 20:37:40 +02:00
c154bcfd83 docs: Update CONTRIBUTING.md to point to latest Melos (#2571)
Since Melos 3 isn't beta anymore we can point directly to the latest
stable release.
2023-06-13 13:25:22 +00:00
390e9700b4 feat(flame): Set a default negative priority on the world for general use (#2572) 2023-06-12 20:01:25 +02:00
3cdef9532d chore(release): Publish flame_tiled 1.11.0 (#2570)
- flame_tiled@1.11.0

Co-authored-by: Lukas Klingsbo <lukasklingsbo@Lukass-MacBook-Pro.local>
2023-06-09 10:54:07 -03:00
dfe18251c1 feat: Add option for a custom image and asset loader (#2569)
Add images and bundle to the named parameters for the creation of a
tiled map.
2023-06-09 10:51:48 +02:00
f440bbf5db feat: Add onInitialState to FlameBlocListener (#2565)
Adding onInitialState to FlameBlocListener to match the implemented interface.
2023-06-07 12:44:05 +00:00
34e5f0e443 fix: Tiled component orthogonal test (#2549)
Fixing orthogonal tiled tests
2023-06-06 13:45:45 -03:00
4710530b42 feat: Add useful methods to Rectangle class (#2562)
Add useful methods to Rectangle class for performing geometrical computations:

* a fromCenter constructor
* an `area` getter
* edges and vertices
* intersections with Line Segment
* toRect()
2023-06-03 18:25:54 +00:00
bcae760c71 fix: Remove mustCallSuper from onComponentTypeCheck (#2561)
@mustCallSuper is very strict requirement. This is true only for
hitboxes and internal engine's logic, but unnecessary for other,
"client-side" game components.
When overriding `onComponentTypeCheck` for component you can simple
return true or false and this would not break anything.
2023-06-02 09:56:22 +00:00
91fc18b1be docs: Enhance "adding the scrolling" section (#2559)
The update method should end up with the code in this order, otherwise the velocity is never set to 0.

Probably obvious but the rest of the steps were precise on where to include these code blocks.

May wanna add this full block to the end of this step as well, I spent a few minutes trying to figure out why it wasn't working propely.
2023-05-31 18:09:57 +00:00
aeef9464f6 fix: Set constraint for test dependency in flame_test (#2558)
Pub is complaining that test doesn't have a constraint.
2023-05-31 09:46:27 -03:00
973b5808dd chore(publish): Publish Flame v1.8.0 and bridge packages (#2557)
flame@1.8.0
flame_rive@1.8.0
flame_test@1.11.0
flame_audio@2.0.3
flame_bloc@1.9.0
flame_fire_atlas@1.3.6
flame_forge2d@0.14.0
flame_isolate@0.4.0
flame_lint@1.0.0
flame_lottie@0.2.0+3
flame_network_assets@0.2.0+2
flame_noise@0.1.1+2
flame_oxygen@0.1.8+3
flame_spine@0.1.0+1
flame_svg@1.7.4
flame_tiled@1.10.2
jenny@1.0.3
v1.8.0 1.8.0
2023-05-28 18:55:47 +00:00
a54f19a405 chore(release): Publish packages (#2555)
- flame@1.8.0
 - flame_rive@1.8.0
 - flame_test@1.11.0
 - flame_audio@2.0.3
 - flame_bloc@1.9.0
 - flame_fire_atlas@1.3.6
 - flame_forge2d@0.14.0
 - flame_isolate@0.4.0
 - flame_lint@0.2.0+3
 - flame_lottie@0.2.0+3
 - flame_network_assets@0.2.0+2
 - flame_noise@0.1.1+2
 - flame_oxygen@0.1.8+3
 - flame_spine@0.1.0+1
 - flame_svg@1.7.4
 - flame_tiled@1.10.2
 - jenny@1.0.3
2023-05-28 18:24:36 +00:00
2f71e06eb8 fix: Update sdk constraints to >=3.0.0 (#2554)
Update the SDK constraint to use >= 3.0.0
2023-05-28 20:09:45 +02:00
5a9434b09a fix: Reduce the Vector2 creations in Anchor (#2550)
This PR changes/reduces the creation of `Vector2` objects to only one.
There is only one method in the `Anchor` class that uses vector2.
2023-05-25 20:05:20 +02:00
52b35fbf56 fix: Avoid creation of unnecessary objects for RiveComponent (#2553)
Avoid creation of unnecessary objects for RiveComponent and simplifies
the example.
2023-05-25 17:04:42 +00:00
2d45d2be39 chore: Remove 1.8.0 deprecations (#2538)
Removes all the deprecated methods before 1.8.0 release.
2023-05-22 19:01:55 +02:00
6e1d5466aa fix: Fix disappearing text on TextBoxComponent for larger pixelRatios (#2540)
When updating to the new Flutter & Flame version I was forced to revisit
the occurences of `window.pixelRatio` and realized there is actually a
bug on TextBoxComponent for certain pixelRatios (depending on the size
of the Canvas).

The bug only manifests after a certain pixelRatio for each base size
because while the canvas is created with the unscaled size, it does
appear to be able to "render" outside of it's bounds for the most times.
However I imagine there must be some optimization under the hood, and
after a certain size increment, the rendering is void.
2023-05-17 07:19:50 -07:00
3849f07d50 fix: Avoid the creation of Vector2 objects in Parallax update (#2536)
This makes the parallax a bit more efficient since it doesn't create new Vector2 objects in the update-loop.
2023-05-14 18:13:43 +02:00
b41622db8f fix: Solve warnings from 3.10.0 analyzer (#2532)
Just solves the warnings that the new Flutter version complains about (which makes us lose 10 points on pub).
2023-05-14 16:25:23 +02:00
7dd2bf7a36 docs: Remove deprecated mixin from klondike tutorial (#2535)
It just removes a deprecated line that is in the tutorial for building a Klondike game. The final code does not have it and it is no longer necessary to have it in the KlondikeGame class.
2023-05-14 12:04:34 +00:00
19d1e72e4b chore(release): Publish flame_spine 0.1.0 (#2531)
- flame_spine@0.1.0
2023-05-10 13:33:18 +01:00
5d1a6fd167 feat: Spine bridge package (#2530)
This PR introduces a bridge package for Spine.

https://user-images.githubusercontent.com/744771/236058480-75c8212b-98e6-4e3b-834a-c1a9d4de31a8.mp4
2023-05-05 23:17:15 +02:00
55ec0bc3cb fix: Move errorBuilder and loadingBuilder to constructors (#2526)
To make it consistent with the other constructors, all builders should be settable from the default constructor.
2023-05-02 21:07:44 +02:00
472356df31 docs: WeldJoint docs and example (#2525)
WeldJoint docs and example
2023-05-01 20:22:28 +02:00
0b68be8a6f feat: Add onComplete callback to AnimationWidget (#2515)
Adds optional onComplete callback to SpriteAnimationWidget for asset constructor.
2023-05-01 16:57:30 +00:00