This PR add an interactive example to show the parent child relationship when their anchors are changed. It also elaborates the same in written docs as well.
While analyzing the tests for flame_bloc, I stumbled upon an interesting conundrum.
It seems that the initialState provided does not trigger a state change callback through onNewState. While that is in line with bloc, I think for most game use cases it is important to keep track of the "last" state of stuff - and in fact most of our existing examples do use the library in that way, to keep track of the last (i.e., the current) state.
However, doing so generically is not simple with the current library because of how the initial state is not provided. While you could initialize your last manually, if there is a dynamic initial state, it would not be trivial to wire it up.
This, therefore, adds a new listener of onInitialState, maintaining the behaviour of onNewState.
Note: this solves the last unused reference from this issue by using it on the new tests.
This PR adds a 3rd toolbar button to FlameStudio for stepping the engine frame by frame. This button will be active only when engine is paused. It steps with the default step time for now, but if/when FlameStudio gets user tweakable preferences, we can open up an option to allow users to override the step time.
This deletes the `packages/flame_flare` project from the monorepo.
I have moved the code back to [its own repo](https://github.com/flame-engine/flame_flare) for archival
purposes.
At this point, we can remove it from the monorepo in preparation for its deprecation.
This PR adds a new method to Game which allows advancing the game loop by a certain amount of time while the engine is paused. By default it assumes one frame to be ~16 ms, but it can be controlled while calling stepEngine
The idea is to allow easy frame by frame inspection of the game. It can even be added to FlameStudio as part of the start/pause buttons on the toolbar.
https://user-images.githubusercontent.com/33748002/233453501-b9f90d49-1834-4f0f-9536-77629cfcadbc.mp4
The previous implementation of the NineTileBox calculates identically sized tiles in a 3x3 grid and does not allow the user to customise this. For example, a 60x60 pixel sprite will be cut into 20x20 pixel tiles. This MR allows the user to specify the sizes of the fixed-width and fixed-height rows and columns so that a completely custom grid is possible.
Example with the following sprite and custom grid sizes.
Note that the stretchable row and column are only 1 pixel wide/high in this example.
The docs of the latest version say "1.7.0" will now go into the
directory "latest" instead of "1.7.0". This commit will now point the
docs to the new location.
This PR is a simultaneous work with flame-engine/flame-docs-site#15
This PR moves out the ticking logic from SpriteAnimation into a new class SpriteAnimationTicker. With this change, users will be able to share the same sprite animation between multiple component without the animation speed getting increased.
At present, indicating the status of the flipped atlas is a bit hard to follow because there are two booleans to decide the status. Actually, they can be represented as a 3-step enum.
This replaces two booleans that indicate the status of the flipped atlas with 3-step enum.
Currently you have to define your polygons in a counterclockwise fashion, with this PR you can define them in both directions since it'll reverse the list if it is in the wrong direction.
Implementing and extending the iterable interface/mixin at the same time breaks Flame in the current beta channel (3.10...).
This PR removes the implementation of the interface to get flame ready for the next flutter release.
This PR adds the following lint rules to our list:
```
always_put_required_named_parameters_first
avoid_multiple_declarations_per_line
avoid_positional_boolean_parameters
avoid_returning_null_for_void
avoid_returning_this
avoid_unnecessary_containers
enable_null_safety
library_private_types_in_public_api
no_leading_underscores_for_library_prefixes
no_leading_underscores_for_local_identifiers
prefer_null_aware_method_calls
tighten_type_of_initializing_formals
unnecessary_late
use_setters_to_change_properties
```
And these rules were considered, and some changes were made according to
them as a clean-up, but in many places they didn't make sense
(`prefer_asserts_with_message` I would have included, but there were too
many places that needed to be changes):
```
collection_methods_unrelated_type
prefer_asserts_with_message
avoid_renaming_method_parameters
```
Styling of the graphs were not proper and custom stylings were being overrided by the default styling. This PR fixes that issue. There is another issue where the arrow is not shown properly and a dimmed line is shown, this is because of improper syntax, that also has ben changed in this commit. And lastly, the component lifecycle graph onLoad and low-level game api graph are fixed.
The yellow styling is defined before default styling which ignores yellow styling. So, moving it after default will work as expected.
Also, the syntax A-- This is a text .->B is not a syntax. So, changing it to either -- or -. | .- completely will fix the non arrow showing line.
This PR changes 3 graphs.
This updates flame_audio to use the recently released audioplayers 4.0.0
Migration instructions:
AudioPool has moved to AudioPlayers, but we still export it from
flame_audio, so the only thing you have to do if you import AudioPool
directly is to change the import to:
import 'package:flame_audio/flame_audio.dart';
fixing link to bare flame tutorial
<!--
The title of your PR on the line above should start with a [Conventional
Commit] prefix
(`fix:`, `feat:`, `docs:`, `test:`, `chore:`, `refactor:`, `perf:`,
`build:`, `ci:`,
`style:`, `revert:`). This title will later become an entry in the
[CHANGELOG], so please
make sure that it summarizes the PR adequately.
-->
# Description
<!--
Provide a description of what this PR is doing.
If you're modifying existing behavior, describe the existing behavior,
how this PR is changing it,
and what motivated the change. If this is a breaking change, specify
explicitly which APIs were
changed.
-->
## 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 `[-]`.
-->
- [ ] 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?
<!--
Would your PR require Flame users to update their apps following your
change?
If yes, then the title of the PR should include "!" (for example,
`feat!:`, `fix!:`). See
[Conventional Commit] for details. Also, for a breaking PR uncomment and
fill in the "Migration
instructions" section below.
### Migration instructions
If the PR is breaking, uncomment this header and add instructions for
how to migrate from the
currently released version to the new proposed way.
-->
- [ ] Yes, this PR is a breaking change.
- [x] No, this PR is not a breaking change.
## Related Issues
<!--
Indicate which issues this PR resolves, if any. For example:
Closes#1234
!-->
<!-- Links -->
[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
Removal of the information concerning effects.reverse() and effects.isReversed in the "Effect" bulletpoint list, as these are outdated and have been removed from the Effect component.
Currently you'll get an error that the late final _original field is already initialized if you re-add effect to a component, since that field is set in onMount. This PR simply removes final from that field so that it can be updated in onMount.
This PR fixes a regression introduced in Flame 1.7.0 and discussed in this thread on discord.
The whole idea is to detect if size is being modified by some external call apart from the autoResizeing code and stop auto-resize from that point onwards.
This PR is the second in a series of refactors that aim to simplify event handling in Flame. The approach is as follows:
Added the MultiTapDispatcher component, which contains the logic that used to be within the HasTappableComponents mixin. This component is internal; it mounts to a FlameGame directly, and ensures that it is a singleton.
Whenever any TapCallbacks component is added to a game, it automatically adds the MultiTapDispatcher component (unless there is already one), which in turn registers a tap gesture detector with GestureDetectorBuilder and rebuilds the game widget.
The end result is that now in order to make a component tappable you only need to add the TapCallbacks mixin to that component, everything else will be handled by the framework.
Consequently, the HasTappableComponents mixin is now empty and marked as deprecated.
Standardize sizes of the different contributing badges on README.md to
200 pixels width.
Sadly the height and style are still different, but that is beyond my
capabilities.
Also adds a star emoji to the star pledge, and slightly improve wording.
#2317 removed the call to `onGameResize` before `onLoad` and since the
viewports relied on that for setting their sizes you couldn't change for
example the `viewfinder.visibleGameSize` before the `CameraComponent`
had been mounted (since `onGameResize` is called right before
`onMount`).
I'm not super happy with the solution, so I'm open to any suggestions.