191 Commits

Author SHA1 Message Date
Erick
6fd36bc1d8 feat: Implement measure to fix ghost lines and graphical artifacts in Sprites (#3590)
Adds features to easily help users to get rid of "ghost lines" and
"texture leak artifacts":
 - Bleed support on sprites
 - Ability to raster Sprite into memory.

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2025-06-10 14:15:52 -03:00
Lukas Klingsbo
26c0d78f12 chore: Fix analyze issues for 3.32.0 (#3605)
Just fixing up some small analyzer issues that popped up in 3.32.0
2025-05-21 19:43:33 +02:00
Lukas Klingsbo
d753a3873c ci: Remove benchmark action until results are more stable (#3603)
Removes the benchmark action until is gives more stable results.
It can still be run locally.
2025-05-19 16:06:29 +00:00
Lukas Klingsbo
2711572952 fix: Add fragment shader extension from flutter_shaders (#3578)
This adds the fragment shader extension from flutter_shaders.
It allows for setting uniforms in a more convenient way.
2025-04-22 20:34:42 +02:00
Renan
c3316ae4a5 feat: Post Process API (#3404)
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2025-04-18 14:19:43 +00:00
Lukas Klingsbo
80a598cd00 fix: The SpriteButton label should be nullable (#3557)
Sometimes all you need to display are within the assets, then there is
no need for a widget label.
2025-04-13 19:24:56 +00:00
zeyus
47fe30dfc9 test: Intermittently failing test due to Float32 prcision (#3556)
Random number generation resulted in occasional errors with the expected
tolerance of specifically the transform2d test. This follows on from the
previous pr #3515

---------

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2025-04-11 11:55:21 +00:00
Lukas Klingsbo
ba2efcd6cf chore: Loosen up constraints on PR title (#3550)
This enables us to start PR titles with other characters than capital
ones.
2025-04-03 17:43:22 +00:00
Luan Nico
c2afe11f2c fix: Fix priority rebalancing causing concurrent mutation of component ordered_set (#3530)
Fix priority rebalancing causing concurrent mutation of component
ordered_set.

This fixes https://github.com/flame-engine/flame/issues/3363

Basically priority changes and rebalancing was not using the component
lifecycle event queue, which caused concurrent mutations and iterations
of the component set, and due to race conditions, loss of components as
they are removed and re-added for rebalancing.

The issue is not with ordered_set itself, but rather how it is being
used. It was never designed to support concurrent mutations.

A few notes for the future:

* I think we should consider changing the whole event (input) system so
that every event is queued and only processed predictably within the
game loop, avoiding a whole class of concurrent modification issues
* we should consider more efficient ways of rebalancing than literally
removing every single component + re-adding (which is also error prone
if there is concurrent access).

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2025-03-21 22:06:20 +00:00
Lukas Klingsbo
f66a920159 chore: Don't compile examples to wasm (#3527)
Since flame_spine is using ffi we can't compile the examples to wasm.
2025-03-13 03:20:16 +00:00
Lukas Klingsbo
ccb5cf0c44 chore: Remove deprecated gh-pages build argument (#3526)
The web-renderer isn't needed anymore, and let's try to use the wasm
compiler for the examples by default.
2025-03-13 03:05:20 +00:00
August
d5ae35f2bb refactor(flame_audio): Set AudioContext for AudioPool only (#3511)
Take advantage of the changes in
https://github.com/bluefireteam/audioplayers/pull/1890

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2025-02-27 02:28:10 +00:00
Liv Tan Ong
678cf05780 feat: Layout Components (#3507)
Laying out of game UI elements in a column or a row is fairly common,
such as for menus, or even HUD buttons.
This PR attempts to create basic layout components that fulfill this
purpose.

---------

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2025-02-27 02:19:12 +00:00
August
762e0ad842 feat(audio): Set audio context AudioContextConfigFocus.mixWithOthers by default (#3483)
# Description

AudioPlayers used to mix their sounds with other audio on the device,
which is not the proposed experience on Mobile devices. So this behavior
was changed in AudioPlayers, but it wasn't enforced due to a bug.
Obviously this behavior is not wanted for Games as multiple sounds
should play simultaneously, so this recovers the old functionality
again.

## Checklist
<!--
Before you create this PR confirm that it meets all requirements listed
below by checking the
relevant checkboxes with `[x]`. If some checkbox is not applicable, mark
it as `[-]`.
-->

- [x] I have followed the [Contributor Guide] when preparing my PR.
- [ ] I have updated/added tests for ALL new/updated/fixed
functionality.
- [ ] I have updated/added relevant documentation in `docs` and added
dartdoc comments with `///`.
- [x] I have updated/added relevant examples in `examples` or `docs`.

Not sure, if I can test this properly, as it's on a system level. I
could ensure the values are set though (?)

## Breaking Change?
I'm actually not sure, if this is breaking, I think it's not, as
`audioplayers` used to work like `mixWithOthers` due to a bug, but is
not anymore.

- [ ] Yes, this PR is a breaking change.
- [x] No, this PR is not a breaking change.

<!--
### Migration instructions

If the PR is breaking, uncomment this header and add instructions for
how to migrate from the
currently released version in-between the two following tags:
-->
<!-- End of exclude from commit message -->

---------

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2025-02-10 08:46:54 +00:00
Lukas Klingsbo
324ac2bfc2 fix: Don't use a future when assets for SpriteButton is already loaded (#3456)
When both images are already loaded and we're using a future it will go
into loading for one tick, with this PR we avoid that.
2025-01-26 16:47:48 +01:00
Luan Nico
9238f7fe73 chore: Update dart-benchmark-action to v0.1.14 (#3452)
Update dart-benchmark-action to v0.1.14
2025-01-21 07:36:53 +01:00
Luan Nico
2d4ececbdf test: Ensure correct permissions for any author on dart_benchmark_action config (#3442)
Ensure correct permissions for any author on dart_benchmark_action
config.
2025-01-09 21:39:38 +00:00
Lukas Klingsbo
9bcef051db ci: Use melos v7.0.0-dev.1 (#3433)
This makes the monorepo make use of `Melos v7.0.0-dev.1` so that we can
use the pub workspaces feature.
2025-01-07 22:11:40 +01:00
Luan Nico
4af202faf5 test: Add very basic benchmark infrastructure (#3431)
Add very basic benchmark infrastructure, using the `examples` app as a
centralized benchmark playground and with first ever benchmark file just
testing some components and updates (more to come).

This also sets up the `dart-benchmark-action` to run, starting on this
very PR!
2025-01-07 08:00:03 +01:00
Luan Nico
1f9b0ea9f3 feat: Add support for strike-through text for flame_markdown (#3426)
Add support for strike-through text for flame_markdown, if enabled by
the user.

Basically parses the `del` HTMl tag and maps it to a new inline text
renderer in Flame's text rendering pipeline.

The style can be controlled with a new property if desired.

In order to parse `~~`-wrapped text into the new node element, the
underlying markdown parser must have the strikethrough option enabled
(or an equivalent custom option), which can be controlled by the user if
providing their own document.
2024-12-29 07:52:53 -08:00
Erick
de74a93b44 feat: Refactoring flame_console to use terminui (#3388)
Simplify flame_console to use `terminui` instead of implementing the
terminal interface itself.
2024-12-16 12:00:26 -03:00
Mike Diarmid
978ad31b42 refactor: Fix lint issues from latest flutter release (#3390)
Updates to use the new color method `withValues`.

---------

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>
2024-12-13 22:40:54 +01:00
Luan Nico
f5f03e5ed7 feat: Add more useful extensions to VectorN and Quaternion [flame_3d] (#3296)
Add more useful extensions to VectorN and Quaternion
2024-12-11 14:26:29 -05:00
Luan Nico
5c508e81bd feat: More Lights! [flame_3d] (#3250)
More Lights! More fun!

I am still trying to get arrays to work (not even the fancy SSBOs, just
plain fixed arrays).

In the meanwhile this puts lights as separate objects.

This supports:

* point lights
* ambient lights
* colors
* intensity


![image](https://github.com/user-attachments/assets/a2f75a8a-9c64-42d1-bbe5-bdf58fa7df69)

---------

Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>
2024-12-11 14:26:29 -05:00
Jochum van der Ploeg
4042d3002c feat(flame_3d): Make shader api more useful (#3085)
Co-authored-by: Luan Nico <luanpotter27@gmail.com>
2024-12-11 14:26:29 -05:00
Luan Nico
a2cc332161 chore: Bump min supported Flutter version to match stable (#3368)
Bumps min flutter version to 3.24 (stable is at 3.24.5 already).
This allows us to finally merge flame_3d in.
2024-12-10 15:59:23 +00:00
Anthony Taormina
8d6a5bb0c2 docs: Fix typo in bug report (#3369)
Fixing a typo I found when submitting a bug.
2024-11-17 23:26:16 +01:00
Lukas Klingsbo
d2d4b372d8 ci: Add actions permissions to release tag job (#3330)
This adds the missing permission to the release tag job.
2024-10-07 19:54:27 +00:00
Lukas Klingsbo
6f59f5b20a ci: Correct env formatting for run (#3314)
The `env:` line was on the wrong indentation level.
2024-09-21 00:00:12 +02:00
Lukas Klingsbo
b2271d7978 ci: Run release workflows with fetch-depth 0 (#3311)
This should fetch all history and tags etc, which is needed to properly
version and publish.
2024-09-20 20:31:43 +00:00
Lukas Klingsbo
d4d9cb62b4 ci: Melos publishing from workflow (#3309)
With this PR we'll be able to publish by running an action from the
Actions tab which will create a release PR that we can review and when
that PR is merged it will tag all new packages and trigger release
workflows for them.
2024-09-20 21:44:07 +02:00
Luan Nico
a0e99dd5b1 chore: Use GitHub Actions setup-node@v4 instead of v3 (#3268)
Use GitHub Actions setup-node@v4 instead of v3.

`v3` is deprecated and giving us warnings:


![image](https://github.com/user-attachments/assets/005add87-fa1f-4d19-933b-148dd855f73d)

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2024-08-12 05:18:54 +00:00
Luan Nico
b05a279540 chore: Use GitHub Actions github-action-dart-analyzer@v3 instead of v2.0.0 (#3269)
Use GitHub Actions github-action-dart-analyzer@v3 instead of v2.0.0

`v2.0.0` uses deprecated versions of other actions giving us warnings:


![image](https://github.com/user-attachments/assets/005add87-fa1f-4d19-933b-148dd855f73d)
2024-08-12 07:12:08 +02:00
Luan Nico
2b8b9b9224 chore: Use GitHub Actions checkout@v4 instead of v3 (#3266)
Use GitHub Actions checkout@v4 instead of v3.
2024-08-11 21:11:28 -04:00
Lukas Klingsbo
fd6719a677 feat: Package for loading XML spritesheets by kenney.nl (#3205)
A parsing package for https://kenney.nl spritesheets.
2024-06-24 23:42:45 +02:00
Luan Nico
28fd2a0f0f fix: Fix text rendering issue where spaces are missing (#3192)
Fix text rendering issue where spaces end up missing.

What happens is that if a single paragraph is split into multiple spans,
due to having different formatting, for example, the layouting engine
will run into an edge case when trying to place the last span. It will:

* split it and try to put each word at a time with the preceding space
* it will eventually find a word that cannot fit, and return to a
partial state
* however, the layouting engine then keeps going and try the same
element again. that is because there could be more elements, and the
engine conflates bits and elements
* now the element "starts" at the next word, and suddenly it fits,
because a new space is not added. this only happens if the final word is
such that it fits by itself but doesn't with the leading space.

That is not normally an issue because if it doesn't fit, it will go to
the next line and the space becomes unnecessary in that case. But in
case we are still trying to populate the same line, we need to make sure
we don't "eat up" the space.

There could be other similar edge cases where a space could go missing,
so I opted to make it explicit whether the initial space should be added
or not by adding a parameter to determine if it is the start of a new
line or not.
2024-06-23 10:07:45 -04:00
Lukas Klingsbo
458d53b63c chore(deps): Bump to Flutter 3.22.0 (#3174)
Bumps Flutter to 3.22.0, needed for #3173
2024-05-27 19:32:12 +02:00
DevKage
6dfc1692bd chore: Pin cspell to 8.8.2 (#3167)
This PR pin down the cspell version to 8.8.2. This will avoid random
cspell check failures caused because of cspell updates.
2024-05-24 08:48:30 +02:00
Luan Nico
8a63a07ae3 feat: Add accessor to determine a TextElement size (#3130)
Add accessor to determine a `TextElement` size.

Currently, there is no way to figure out the actual size of a
`TextElement`.

This is quite important as the element will have the lines laid out and
broken down, so we need a way to determine the height of the resulting
bounding box.

Before:
<img
src="https://github.com/flame-engine/flame/assets/882703/5d69d9dd-068f-4deb-8dd6-19c90aca01db"
width="30%" />

After:
<img
src="https://github.com/flame-engine/flame/assets/882703/a235badd-734f-4eb6-880a-3ebe0edc9433"
width="30%" />
2024-04-18 15:46:05 -04:00
Brett Morgan
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
Andrew Leach
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
Andrew Leach
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
Lukas Klingsbo
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
```
2024-02-11 11:34:45 +01:00
Andrew Leach
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
Andrew Leach
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
Luan Nico
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
Gnarhard
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
Lukas Klingsbo
45c87ddfb6 feat!: Transfer flame_texturepacker to monorepo (#2987)
This PR transfers the
[flame_texturepacker](https://github.com/Brixto/flame_texturepacker) to
the monorepo and updates it to be compatible with the rest of the
structure (linting etc).
2024-01-25 14:40:16 +00:00
Johannes Löhnn
6a1059b0a6 fix: CameraComponent no longer throws Concurrent modification on stop (#2997)
When camera is following a component and trying to follow another target
I got an exception:
```
dart:core                                              Iterable.forEach
package:flame/src/camera/camera_component.dart 326:25  CameraComponent.stop
package:flame/src/camera/camera_component.dart 309:5   CameraComponent.follow
test/camera/camera_component_test.dart 69:14           main.<fn>.<fn>
package:flame_test/src/test_flame_game.dart 80:21      testWithGame.<fn>

Concurrent modification during iteration: _Set len:0.
```

Copying viewfinder children before iterating through it and removing
child from parent does the trick, as we are not iterating through the
same list as we are removing items from, but rather a copy of it.

I tried to use camera from `game` provided in the test but it is AFAIK
not mounted and will hence not queue modifications (adds and removes).
Hence I create a new camera and mount it.
2024-01-23 08:55:05 +00:00
markvideon
7ac80a78e9 fix: Change return type of RiverpodComponentMixin.onLoad to FutureOr<void> (#2964)
This PR changes the return type of RiverpodComponentMixin.onLoad to
match that of Component.onLoad.

This resolves #2961 which describes an error preventing use of
RiverpodComponentMixin on Component subclasses that return a Future in
their implementation of onLoad due to a signature mismatch.


Closes #2961.

---------

Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2024-01-07 17:09:56 +00:00