Adds new package flame_gamepads. This package provides a
GamepadCallbacks mixin to use gamepads library with Flame.
---------
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
# Description
The docs site build was triggered on every push to `main`, causing
unnecessary rebuilds. This PR moves the docs dispatch trigger into a
dedicated `docs.yml` workflow that only runs when:
- Files in `doc/**` change on `main`
- A new `v*` tag is created
The examples gh-pages deployment in `gh-pages.yml` remains unchanged.
## Checklist
- [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 `///`.
- [-] I have updated/added relevant examples in `examples` or `docs`.
## Breaking Change?
- [ ] Yes, this PR is a breaking change.
- [x] No, this PR is not a breaking change.
## Related Issues
[Contributor Guide]:
https://github.com/flame-engine/flame/blob/main/CONTRIBUTING.md
[Conventional Commit]: https://conventionalcommits.org
[CHANGELOG]:
https://github.com/flame-engine/flame/blob/main/CHANGELOG.md
Adds a new step to the `release-tag.yml` workflow that automatically:
1. Creates a short `v{version}` tag (e.g. `v1.36.0`) pointing at the
same commit as the melos-generated `flame-v{version}` tag
2. Creates a GitHub release with the flame package changelog as release
notes
This removes the manual step of creating the `v` tag and GitHub release
after each flame release.
This PR adds a new
HueEffect
to the Flame effects library. This effect allows animating the hue shift
of a component's paint over time.
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
Addresses unchecked items from #2895:
- Add introductory "why" paragraphs to each major documentation section,
with links to related Flutter/game dev concepts
- Split the monolithic components.md (1500+ lines) into focused pages
under components/
- Fix grammar, typos, and style issues across all doc/flame/ files
- Replace deprecated gameRef with game and fix outdated Future<void>?
signature
- Remove outdated Flutter 3.13 version reference
- Replace all -- with proper punctuation
Added Basic Shader Tutirial to Flame documentation.
Added one note to CONTRIBUTING.md, which explains how to resolve non
UTF-8 characters in path.
---------
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
# Description
Fixes#3809
`flame_3d` crashes on Android GLES because `spatial_material.frag`
declares `uint numLights` and `lighting_info.dart` sets it via
`shader.setUint()`. Impeller's GLES backend only supports `float`
uniforms — the `uint` path hits an unhandled shader type and crashes.
Changed `uint` → `float` in the shader and `setUint` → `setFloat` in
Dart. The value is a light count (0–3) so `float` works identically.
Recompiled the shaderbundle.
## Checklist
- [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 `///`.
- [ ] I have updated/added relevant examples in `examples` or `docs`.
No test added — the crash only reproduces on a real GLES
device/emulator, not in unit tests. The existing lighting logic is
unchanged; only the uniform type is corrected.
## Breaking Change?
- [ ] Yes, this PR is a breaking change.
- [x] No, this PR is not a breaking change.
<!-- Links -->
[Contributor Guide]:
https://github.com/flame-engine/flame/blob/main/CONTRIBUTING.md
---------
Co-authored-by: Luan Nico <luanpotter27@gmail.com>
Bump the Flutter and dartdoc version so that we can develop with the new
Flutter version.
This aggressive bump is due to Flutter bumping dartdoc to 9.0.0.
Prepared all packages to be released to pub.dev
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Update cspell used on CI to latest version `9.2.1`:
https://www.npmjs.com/package/cspell
Note that the contributing guidelines does not mandate a version, so
this (the latest) will be installed if following those instructions.
Fix cspell verify script to use the run script.
As part of investigating why the newest cspell version [causes
issues](https://github.com/flame-engine/flame/pull/3727) with the verify
script, I first notice that we don't run cspell with the correct flags
inside the verify script (notably not applying our own config file).
This fixes that by re-using the run script in the verify script, which
avoid repetition and future drift.
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
Fix alphabetization check in cspell verify script; it was using
non-bash-compliant code that would not actually work on certain systems;
in fact, it was not working on CI, which has caused some drift. This
also fixes the dictionaries.
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
* The root package should be named `_` in pub workspaces that doesn't
have an actual app or package in the root.
* Melos needs to be updated to support this.
* The flame_3d example should be named flame_3d_example to follow the
convention.
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>
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>
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>
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>
# 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>
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!
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.
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>
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

---------
Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>