3302 Commits

Author SHA1 Message Date
0028b5cb15 docs: Jenny example (#3086)
Replace this text.

---------

Co-authored-by: xjyribro <limcheekee.63@gmail.com>
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2024-03-23 13:21:09 +01:00
cc035fb4a3 refactor: Change the ClipComponent factory Constructor to redirect Constructor (#3089)
The ClipComponent factory Constructor "circle", "rectangle" and
"polygon" are now redirect Constructor while they persist their previous
behaviour and syntax.
This allows subclasses of ClipComponent to directly address them.
```dart
/// Examples: 

SubClass.fancyShape() : super.polygon();
Smiley() : super.circle();
```

---------

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2024-03-21 11:52:12 +01:00
8f50c92795 fix: Updated oxygen dep to v0.3.1 and added removing components (#3087)
Updated oxygen dep to v0.3.1 and added call to new method to remove
components.
2024-03-20 09:27:01 +01:00
e3e755c6de feat: Update http dependency on flame_network_assets (#3084)
Updates the http dependency on flame_network_assets
2024-03-18 15:06:28 -03:00
bf3c282dd6 feat: Add SpriteBatch.replace to allow the replacement of the batch information (#3079)
This PR adds a new method to the `SpriteBatch` class which allow users
to replace the information, based on an index of the batch.

This is useful when you want to change some of the rendering calls
without having to rebuild the whole batch.

---------

Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>
2024-03-18 10:41:46 -03:00
76498eb95a chore: Add riverpod as a direct dependency to flame_riverpod flame_riverpod-v5.4.0 2024-03-15 12:05:36 +01:00
af6ee64917 chore: Publish flame_riverpod v5.4.0 (#3081)
```
Package Name     Current Version   Updated Version   Update Reason
flame_riverpod   5.3.0             5.4.0             updated with minor changes
```
2024-03-15 12:02:39 +01:00
b44011fd71 fix: Resolve logic error with assignment of ComponentRef's game property in flame_riverpod (#3082)
Assignment of the game property on Components using
RiverpodComponentMixin was being performed inside the onLoad method,
meaning if components were unmounted and mounted once again, attempts to
invoke callbacks to the GameWidget's build method would throw an
exception.

This functionality has been moved to the onMount method, where it always
should have been.
2024-03-15 10:38:51 +00:00
44b10fd60c feat: Allow ComponentRef access in RiverpodGameMixin (#3010)
This PR allows `ComponentRef` access through the `RiverpodGameMixin`.


Closes #2971

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-03-15 07:03:55 +00:00
e3aaa7c21d fix: Resolve breaking changes from Riverpod affecting flame_riverpod (#3080)
Changes to how support for manual listeners is implemented in
flutter_riverpod 2.5.1 (released 4 days ago) have affected
flame_riverpod - specifically, the implementation of
ProviderSubscription.

This PR updates the implementation of manual listeners in flame_riverpod
in the same manner that flutter_riverpod has.
2024-03-15 07:57:24 +01:00
17da92b2d1 fix: Implement necessary ProviderSubscription getters (#3075)
This adds implementations of the necessary `ProviderSubscription`
getters.
2024-03-11 22:34:48 +01:00
faf2df4b8c feat: Add initial version of behavior_tree and flame_behavior_tree package (#3045)
First pass on adding behavior tree for flame. This PR adds 2 packages:

- behavior_tree: A pure dart implementation of behavior tree.
- flame_behavior_tree: A bridge package that integrates behavior_tree
with flame.

Demo: 


https://github.com/flame-engine/flame/assets/33748002/1d2b00ab-1b6e-406e-9052-a24370c8f1ab
2024-03-10 17:29:15 +01:00
f49d24c02d fix!: Removed unused parameters from SpriteWidget (#3074)
The unused fields of "SpriteWidget", "srcPosition" and "srcSize" and
their matching parameter in the default constructor has been removed.


If SpriteWidget is used, remove the parameter srcPosition and srcSize as
they have not been used in the default constructor.
(This does not belong to SpriteWidget.asset())
2024-03-08 15:59:35 +01:00
9282cc38f0 fix: Clamp opacity set by the ColorEffect to 1.0 (#3069)
Clamp opacity set by the ColorEffect to 1.0; this was causing an issue
when the tween returned values greater than 1.

The test shows that when dt is greater than 0.5 and less than 0.75 for a
period of 1 the tween returns approx 1.2 which causes Color to throw an
exception.

This has now been fixed.

Since https://github.com/flutter/flutter/issues/89433 has also now been
fixed, I have changed the min opacity to 0.
2024-03-06 13:47:00 +00:00
12841d6471 docs: Update RawKeyEvent references to KeyEvent (#3052) (#3053)
This PR fixes #3052 and updates deprecated type references in docs from
`RawKeyEvent` to `KeyEvent`.

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-03-06 14:40:54 +01:00
1c51334e86 feat: Add initial version of flame_sprite_fusion package (#3062)
This PR adds a new package which makes it easier to parse and render
tilemaps exported from [Sprite Fusion](https://www.spritefusion.com/).
2024-03-05 09:49:46 +01:00
c92910c688 feat: Initial functionality of flame_devtools (#3061)
![image](https://github.com/flame-engine/flame/assets/744771/4ca93f5f-369e-4644-b7fb-1d7790b962e2)

This adds a structure and some basic functionality for the Flame
devtools extension.

Later I will add a pre/post-hook for publishing to Melos so that it can
build the devtools extension before publishing (and remove the directory
afterwards), since it isn't committed to this repository. For now one
has to run `melos devtools-build` before publishing.

---------

Co-authored-by: Renan <6718144+renancaraujo@users.noreply.github.com>
Co-authored-by: Erick <erickzanardoo@gmail.com>
2024-03-05 01:04:43 +01:00
30fde805b4 refactor!: Use HasTimeScale for Route (#3064)
This PR replaces the `Route.timeSpeed` with `HasTimeScale.timeScale`.
2024-03-03 13:17:54 +01:00
72678c6760 fix: FutureOr return type of ComponentViewportMargin.onLoad (#3059)
Closes #3058
2024-03-02 00:42:54 +01:00
2ed71a3c89 fix: Size for SpriteComponent.fromImage should be nullable (#3054)
I received an assertion error after I set `autoResize` to true when I am
using `SpriteComponent.fromImage` component. It's kinda weird for me
that the message tells me **"If size is set, autoResize should be false
or size should be null when autoResize is true.''**, but the thing is I
never set the size for that image yet. Then, I check the code and I
found out that the size will never be null anyway, so the `autoresize`
should always be false.

In this PR, I just remove all the fallback value for `size`, so it would
not give an assertion error when `size` is not being set yet while the
`autoresize` is true.

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-03-01 21:01:53 +00:00
741d9384db fix: Revert "feat(flame_3d): initial implementation of 3D support" (#3060)
This reverts commit e434bafb15fc486c51b43aaa9d9190b8b7e783cb (flame_3d)
for the time being so that we can get the pipeline back up running.
2024-03-01 20:48:40 +00:00
e434bafb15 feat(flame_3d): initial implementation of 3D support (#3012)
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-02-26 15:52:33 +01:00
41e9e4e38c feat: Export TileAtlas from flame_tiled package (#3049)
`TileAtlas` has a `clearCache` method which the users might need to call
from their code. This is recommended in our docs here:
https://docs.flame-engine.org/latest/bridge_packages/flame_tiled/flame_tiled.html#clearing-images-cache

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-02-25 11:08:14 +00:00
3a24a51d10 fix: Check for removing state while adding a child (#3050)
Adding a child component to a parent which is in `removing` state,
caused the lifecycle processing to go into a cyclic dependency when the
parent is re-added. It happens because, while processing the lifecycle
events, child's add event causes itself and the parent to get added to
the blocked list. As a result of this, when the parent's add event is
processed next, it gets skipped due to being in the blocked list.

This PR makes sure that the child does not get enqueued when parent is
about to be removed.
2024-02-25 12:02:20 +01:00
892052b99a feat(flame_texturepacker): Expose TexturePackerAtlas (#3047)
Closes #3046

---------

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2024-02-20 09:35:06 +01:00
6270353af9 feat: Add HasPerformanceTracker mixin on Game (#3043)
This PR adds a `HasPerformanceTracker` mixin on `Game`. This mixin will
allow for tracking the update and render time of the game.
2024-02-18 18:53:29 +01:00
d409193300 chore(release): Publish Flame v1.16.0 et. al (#3044)
```
Package Name           Current Version   Updated Version   Update Reason
flame                  1.15.0            1.16.0            manual versioning
flame_audio            2.1.8             2.10.0            manual versioning
flame_bloc             1.10.10           1.11.0            manual versioning
flame_fire_atlas       1.4.8             1.5.0             manual versioning
flame_rive             1.9.11            1.10.0            manual versioning
flame_riverpod         5.2.0             5.3.0             manual versioning
flame_svg              1.9.0             1.10.0            manual versioning
flame_test             1.15.4            1.16.0            manual versioning
flame_texturepacker    3.0.0             3.1.0             manual versioning
flame_tiled            1.18.4            1.19.0            manual versioning
flame_forge2d          0.16.0+5          0.17.0            updated with major changes
flame_isolate          0.5.1             0.6.0             updated with major changes
flame_lottie           0.3.0+8           0.4.0             updated with major changes
flame_markdown         0.1.1+8           0.2.0             updated with major changes
flame_network_assets   0.2.0+13          0.3.0             updated with major changes
flame_noise            0.2.0             0.3.0             updated with major changes
flame_oxygen           0.1.9+8           0.2.0             updated with major changes
flame_spine            0.1.1+10          0.2.0             updated with major changes
flame_splash_screen    0.2.0             0.3.0             updated with major changes
jenny                  1.2.1             1.3.0             updated with minor changes
```
flame_markdown-v0.2.0 flame_lottie-v0.4.0 flame_isolate-v0.6.0 flame_riverpod-v5.3.0 flame_oxygen-v0.2.0 jenny-v1.3.0 flame_rive-v1.10.0 flame_audio-v2.10.0 flame-v1.16.0 flame_spine-v0.2.0 flame_splash_screen-v0.3.0 flame_noise-v0.3.0 flame_network_assets-v0.3.0 flame_svg-v1.10.0 flame_test-v1.16.0 flame_tiled-v1.19.0 flame_forge2d-v0.17.0 flame_texturepacker-v3.1.0 flame_fire_atlas-v1.5.0 flame_bloc-v1.11.0 v1.16.0 1.16.0
2024-02-17 11:23:14 +01:00
7c3038becb fix: BodyComponent fixtures should test with global point (#3042)
The previous solution didn't take the whole transform into
consideration, this one does.



Closes: #3039
2024-02-17 10:34:44 +05:30
4f053ed74c fix: Vertices in PolygonComponent should subtract vertices positioning (#3040)
If the vertices in the `PolygonComponent` weren't starting at 0,0 they
got the wrong hitbox, but rendered correctly.
This PR fixes that.

Closes: #3031
2024-02-16 15:09:45 +01:00
330862c98e fix!: Migrate from RawKeyEvent to KeyEvent (#3002)
First pass at migrating from `RawKeyEvent` and `RawKeyboard`
to `KeyEvent` and `HardwareKeyboard`.

Context:
https://docs.flutter.dev/release/breaking-changes/key-event-migration
2024-02-15 23:10:51 +01:00
20d368c326 chore: Fix dangling_library_doc_comments (#3038)
This is decreasing flame's points on pub.
2024-02-15 15:43:34 +01:00
8ee466860a chore: Convert the improvement suggestion template to an issue form (#3037)
Follow up to: https://github.com/flame-engine/flame/pull/3036

This PR is doing:
- Adding a new issue form to replace the template found here:
https://github.com/flame-engine/flame/blob/main/.github/ISSUE_TEMPLATE/3_improvement.md
- Also _deletes_ the template, so we don't see duplicates when a user
comes to create a feature request.
- **Functionality change** I also disabled blank issue creation
([see](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser))
to encourage form usage, should we keep this?

Proposed new form looks like:
<img width="974" alt="image"
src="https://github.com/flame-engine/flame/assets/13091188/6043ce72-cbda-43be-9f3c-1092e38b13c2">
2024-02-14 11:26:45 +01:00
219226201a feat: Add new methods to CommandStorage to support more arguments (#3035)
Added new **addCommand4** and **addCommand5** methods to the
_CommandStorage_ class from the Jenny package.
2024-02-14 09:53:39 +00:00
d2e62bdb5d chore: Convert the feature request template to an issue form (#3036)
Similar to: https://github.com/flame-engine/flame/pull/3027

This PR is doing:
- Adding a new issue form to replace the template found here:
https://github.com/flame-engine/flame/blob/main/.github/ISSUE_TEMPLATE/2_feature.md
- Also _deletes_ the template, so we don't see duplicates when a user
comes to create a feature request.

Proposed new form looks like:
<img width="957" alt="image"
src="https://github.com/flame-engine/flame/assets/13091188/86dcbe60-d0fb-4f77-ab97-8895e3b69e8f">

I took some leniences in design decisions with making, which happy to
change if needed:
- The problem _and_ proposal text areas **required**
- Turned the "are you interested in doing a PR?" into a checkbox.
2024-02-14 09:39:50 +00:00
78380b9d3b feat: Add TiledObjectHealpers extension on TiledObject (#3032)
This PR adds an extension on `TiledObject` to allow getting the object's
`position` and `size` as `Vector2` objects.

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-02-11 17:06:51 +00:00
d78f7f83b9 chore(release): Publish flame_svg v1.9.0 (#3033)
```
Package Name   Current Version   Updated Version   Update Reason
flame_svg      1.8.10            1.9.0             updated with minor changes
```
flame_svg-v1.9.0
2024-02-11 11:34:45 +01:00
b0cafb2a55 feat: Add loadFromString to Svg class (#3030)
Lets you create an `Svg` directly from a string instead of from a file.
2024-02-09 17:18:19 +01:00
64e8dc2193 chore: Remove the old bug template for issue creation (#3028)
Now that we have a functional issue form for creating a bug report (see:
https://github.com/flame-engine/flame/issues/new?template=bug_report.yml)
we can delete the template, to ensure we're not getting duplicate bug
options on the templates page (see
https://github.com/flame-engine/flame/issues/new).

This PR removes the old template format.
2024-02-09 10:32:48 +00:00
64631b25f2 chore: Minor updates to bug_report form (#3027)
This PR's main aim is to fix the validation errors (seen
[here](https://github.com/flame-engine/flame/blob/main/.github/ISSUE_TEMPLATE/bug_report.yml))
within the bug report yaml to make this a valid form based on GitHubs
schema.

That being said, the main changes are:
- Ensure each form has a unique ID
- A proposal to change the "affected platforms" from a textarea to a
dropdown
- Small phrasing changes, happy to revert if needed.
2024-02-09 09:27:45 +00:00
04527886cd docs: Update widgets documentation (#3024)
The documentation regarding the widgets are so outdated and it is very
confusing for a beginner like me. So, I update them to make it easier
for others to follow.

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-02-09 08:33:03 +00:00
1d020a525b refactor: Fix unrelated types reported by DCM (#3023)
DCM recently started reporting
`avoid-collection-methods-with-unrelated-types` for the quadtree class,
this PR fixes the reported issues.
2024-02-08 10:09:00 +01:00
abca337734 chore(release): Publish Flame v1.15.0 (#3022)
```
The following 18 packages will be updated:

Package Name           Current Version   Updated Version   Update Reason
flame                  1.14.0            1.15.0            updated with minor changes
flame_isolate          0.5.0+7           0.5.1             updated with minor changes
flame_noise            0.1.1+12          0.2.0             updated with major changes
flame_riverpod         5.1.5             5.2.0             updated with minor changes
flame_test             1.15.3            1.15.4            updated with patch changes
flame_texturepacker    2.1.0             3.0.0             updated with major changes
flame_oxygen           0.1.9+7           0.1.9+8           dependency was updated
flame_tiled            1.18.3            1.18.4            dependency was updated
flame_fire_atlas       1.4.7             1.4.8             dependency was updated
flame_audio            2.1.7             2.1.8             dependency was updated
flame_spine            0.1.1+9           0.1.1+10          dependency was updated
flame_bloc             1.10.9            1.10.10           dependency was updated
flame_rive             1.9.10            1.9.11            dependency was updated
flame_lottie           0.3.0+7           0.3.0+8           dependency was updated
flame_markdown         0.1.1+7           0.1.1+8           dependency was updated
flame_forge2d          0.16.0+4          0.16.0+5          dependency was updated
flame_svg              1.8.9             1.8.10            dependency was updated
flame_network_assets   0.2.0+12          0.2.0+13          dependency was updated
```
flame_audio-v2.1.8 flame_markdown-v0.1.1+8 flame_isolate-v0.5.1 flame_network_assets-v0.2.0+13 flame_forge2d-v0.16.0+5 flame_lottie-v0.3.0+8 flame_test-v1.15.4 flame_svg-v1.8.10 flame_spine-v0.1.1+10 flame_riverpod-v5.2.0 flame_rive-v1.9.11 flame_fire_atlas-v1.4.8 flame_texturepacker-v3.0.0 flame_bloc-v1.10.10 flame-v1.15.0 flame_oxygen-v0.1.9+8 flame_noise-v0.2.0 flame_tiled-v1.18.4 v1.15.0 1.15.0
2024-02-07 21:23:29 +01:00
5d3be3137a refactor: Minimize Vector2 creation in IsometricTileMapComponent (#3018)
The `IsometricTileMapComponent` was creating a lot of new `Vector2`
objects, this PR minimizes the creation of them.
2024-02-05 12:54:39 +01:00
e27818d872 fix: Set margins of JoystickComponent properly (#3019)
The margins of the `JoystickComponent` weren't set properly, this PR
fixes that.
2024-02-05 11:02:02 +00:00
bf8aecdbfa docs: Fix positioning of git commit message exclusion blocks in the PR template (#3016)
Fix positioning of git commit message exclusion blocks in the PR
template. I found it a bit confusing as I think what we want to
encourage is that the migration instructions go into the git message,
but rn there is just a "Replace or remove this text." lost after the
related issues. I don't think we want to include related issues? So it
seems just out of order.

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-02-04 15:44:44 +00:00
2fd84c846f feat!: Update flame_noise to use latest version of fast_noise (#3015)
Update flame_noise to use the latest version of fast_noise, basically
replacing the Perlin-specific effect controller with a generic
`NoiseEffectController` that can take in any noise class (leveraging the
new Noise2 interface).

Just update from `PerlinNoiseEffectController` to
`NoiseEffectController` and provide the noise/parameters you want
directly into the `noise` field.

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-02-04 16:37:54 +01:00
343bdca79b chore: Fix warnings and lint issues across the codebase (#3017)
Fix warnings and lint issues across the codebase.

This includes:
* equals should now be Object instead of dynamic (and thus we don't need
_help.dart anymore)
* the `always_require_non_null_named_parameters` lint rule is removed
* the `avoid-banned-imports` rule from DCM actually doesn't do anything
unless configured
2024-02-04 16:21:14 +01:00
982f2263da refactor: Update flame_texturepacker's file structure (#3014)
This update `flame_texturepacker` to follow the same directory structure
as we have in the rest of the packages.
2024-02-04 14:34:51 +00:00
23cf8b9de8 fix: Properly update sprites in SpriteButtonComponent (#3013)
Previously if you replaced a sprite in a `SpriteButtonComponent` with
`component.button = ...` it didn't update the button visually since the
`sprites` map wasn't updated, this PR solves that.
2024-02-01 11:22:33 +01:00
4e6968a05c feat: TexturePacker atlas can be generated from device's file (#3006)
TexturePacker atlas can be generated from device's file.

---------

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-01-29 10:09:24 +01:00