Commit Graph

3302 Commits

Author SHA1 Message Date
DevKage
a4f60a8e44 docs: Add interactive example for Anchor (#2523)
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.
2023-05-01 18:43:20 +02:00
Luan Nico
01121c220b feat: Add listener for initial state on flame_bloc (#2382)
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.
2023-05-01 15:41:01 +02:00
DevKage
532899c0ec feat: Add next frame button to FlameStudio (#2522)
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.
2023-04-30 00:11:49 +02:00
Luan Nico
434587d66b chore: Remove flame_flare (#2521)
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.
2023-04-28 13:28:47 -04:00
Jithuraj
306ad32052 docs: Update content types of sphinx code snippets (#2519)
Update content types of some sphinx code snippets.
2023-04-25 16:28:54 +02:00
Eugene Kleshnin
0991c3bf67 docs: RopeJoint documentation and example (#2520)
RopeJoint documentation and example
2023-04-25 10:37:31 +02:00
Jithuraj
f9fd95439c docs: Sphinx code snippet copy button design break (#2518) 2023-04-24 18:01:52 +00:00
DevKage
1ed2c5a297 feat: Add stepEngine to Game (#2516)
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
2023-04-23 21:28:37 +02:00
Lukas Klingsbo
9ab1adec1b chore(release): Publish flame_audio 2.0.2 (#2514)
- flame_audio@2.0.2
2023-04-19 20:29:16 +00:00
Lukas Klingsbo
e699b259e9 fix: Release instead of dispose audioplayer in play (#2513)
The `AudioPlayer` should not be disposed when it should be continued to
be used, it should be `release`d.
2023-04-19 22:18:52 +02:00
Peter Vullings
a25b0a03a5 feat: Customise grid of NineTileBox (#2495)
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.
2023-04-19 08:04:09 +00:00
Lukas Klingsbo
87b8a067f3 refactor!: Move CameraComponent and events out of experimental (#2505)
This moves the CameraComponent and the new event system out of experimental since this now is the recommended way of handling things.
2023-04-19 09:55:32 +02:00
Lukas Klingsbo
89926227c5 feat: Accept CollisionType in hitbox constructor (#2509)
With this PR we accept the `CollisionType` directly in the constructor.
2023-04-18 13:57:16 +00:00
Lukas Klingsbo
80019a9407 docs: Update Game docs (#2507)
The docs regarding the lifecycle of the game was outdated, this PR
updates them.
2023-04-18 14:36:54 +01:00
Lukas Klingsbo
7ad8fe761f docs: Consider "latest" as the latest version (#2508)
After the #2345 change we also have to consider "latest" as the latest version, so that we don't show a warning box for that.
2023-04-16 14:59:20 -03:00
Sai Rajendra Immadi
738d7ac027 docs: Change latest version href (#2506)
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
2023-04-16 14:28:36 +00:00
DevKage
a50c80cfa3 feat!: Add SpriteAnimationTicker (#2457)
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.
2023-04-16 16:13:14 +02:00
Lukas Klingsbo
9591e28541 chore(release): Publish packages (#2504)
- flame@1.7.3
 - flame_audio@2.0.1
 - flame_bloc@1.8.4
 - flame_fire_atlas@1.3.5
 - flame_flare@1.5.4
 - flame_forge2d@0.13.0+1
 - flame_isolate@0.3.0+1
 - flame_lint@0.2.0+2
 - flame_oxygen@0.1.8+2
 - flame_rive@1.7.1
 - flame_svg@1.7.3
 - flame_test@1.10.1
 - flame_tiled@1.10.1
 - jenny@1.0.2
 - flame_noise@0.1.1+1
 - flame_network_assets@0.2.0+1
 - flame_lottie@0.2.0+2
2023-04-16 01:18:03 +02:00
Hwanseok Barth Kang
643793d06e refactor: Make atlas status to be more readable (#2502)
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.
2023-04-15 22:26:08 +00:00
Lukas Klingsbo
c4c516ebf8 fix: Reverse invalid polygon definitions (#2503)
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.
2023-04-15 22:15:44 +00:00
Lukas Klingsbo
d51a612f8b fix: Fill in mount implementation in HasTappables (#2496)
HasTappables also needs the same full implementation in mount as HasTappableComponents has for Tappable to work properly.
2023-04-15 15:49:11 +00:00
DevKage
aa8d49da9e fix: Modify size only if changed while auto-resizing (#2498)
Checks the size before modifying and skips if it hasn't changed.
2023-04-15 14:41:44 +00:00
Erick
81303ea9d8 feat: Bump ordered_set version (#2500)
Bump the version of ordered_set to ensure that users gets the fixed version.
2023-04-15 00:09:53 +02:00
Erick
3e5be3d6c2 fix: RecycleQueue cannot extends and implements Iterable at the same time (#2497)
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.
2023-04-14 10:41:13 -03:00
Hwanseok Barth Kang
a66f2bc0a9 fix: Remove memory leak when creating the image from PictureRecorder (#2493)
This PR replaces the Picture.toImage() with Picture.toImageSafe() that automatically calls the Picture.dispose().
It will eliminate the memory leak.
2023-04-13 22:00:25 +02:00
Lukas Klingsbo
dbda37b81a refactor: Add new lint rules (#2477)
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
```
2023-04-13 19:42:00 +00:00
Eugene Kleshnin
78b585fe8e docs: Added GearJoint docs and example (#2487)
GearJoint docs and example
2023-04-13 21:09:26 +02:00
Lukas Klingsbo
95e34515df chore(release): Publish flame_audio 2.0.0 (#2484)
Release flame_audio@2.0.0 which uses audioplayers 4.0.0
2023-04-11 20:59:58 +00:00
Lukas Klingsbo
5736a0345b ci: Update PR title validator (#2481)
Bump to newest version of amannn/action-semantic-pull-request.
2023-04-11 20:51:03 +00:00
Sai Rajendra Immadi
61cb271e8a docs: Fix mermaid graphs (#2483)
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.
2023-04-11 20:04:01 +00:00
Lukas Klingsbo
47372087f2 feat!: Update AudioPlayers to ^4.0.0 (#2482)
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';
2023-04-11 21:51:43 +02:00
Lukas Klingsbo
bd3e788612 feat: Deprecate Component.changeParent (#2478)
Since we now have a setter directly for parent, changeParent is no longer needed.
2023-04-11 16:55:27 +02:00
Asperson
8fbdc2205a docs: Fix link in step1.md (#2479)
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
2023-04-11 00:00:46 +02:00
Lukas Klingsbo
65505c9510 docs: Update timer rendering docs (#2474)
The timer docs were using the old TextConfig rendering class, this updates it to use TextPaint.
2023-04-09 11:39:49 -03:00
Jacda
e1f715d5b3 docs: Remove deprecated effects.reverse docs (#2476)
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.
2023-04-09 00:02:40 +02:00
Lukas Klingsbo
112b00b01c chore(release): Flame v1.7.2 (#2473)
Releasing Flame v1.7.2 with two bug fixes.
2023-04-07 10:28:54 -03:00
Eugene Kleshnin
e4f741ef23 docs: PrismaticJoint docs and example (#2470)
PrismaticJoint example and documentation
2023-04-07 12:17:05 +00:00
DevKage
de630a1c3a feat: Add isDragged in DragCallbacks mixin (#2472)
Adding a isDragged state for DragCallbacks mixin. This was available in the Draggable mixin.
2023-04-07 13:39:28 +02:00
DevKage
e7ebf8e55a fix: A mistake in auto-resizing disabling logic (#2471)
Fixes a mistake made in auto-resize disabling logic submitted via #2467
2023-04-07 11:03:30 +02:00
Lukas Klingsbo
6fa9e9d547 fix: It should be possible to re-add ColorEffect (#2469)
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.
2023-04-06 10:12:02 +02:00
Lukas Klingsbo
c6f467b4e6 chore(release): Publish Flame v1.7.1 (#2468)
Release of Flame v1.7.1
2023-04-05 16:25:10 -03:00
DevKage
df236af4f0 fix: Stop auto-resizing on external size change in sprite based components (#2467)
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.
2023-04-05 15:47:56 +00:00
Jithuraj
be31336da5 docs: Add sphinx copy button configurations in conf.py (#2466)
Add sphinx copy button configurations in conf.py
2023-04-05 16:13:24 +02:00
Lukas Klingsbo
ac878d8edf chore(release): Publish packages (#2462) 1.7.0 v1.7.0 2023-04-02 20:06:47 +02:00
Lukas Klingsbo
ee49565810 chore: Remove deprecations before v1.7.0 release (#2461)
Removes everything that was marked for removal for v1.7.0 (or earlier...)
2023-04-02 17:16:41 +00:00
Lukas Klingsbo
b5bdf4ec17 feat!: The HasTappableComponents mixin is no longer needed (#2450)
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.
2023-04-02 16:52:57 +00:00
Luan Nico
8319056477 docs: Standardize sizes of the different contributing badges on README.md (#2459)
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.
2023-04-02 12:39:56 -04:00
Lukas Klingsbo
13cce4aed6 fix: Materialize list in Component.removeWhere (#2458)
This is needed since it'll get a ConcurrentModificationException in some cases otherwise, like in the test added for example.
2023-04-02 15:54:49 +00:00
Lukas Klingsbo
d1ac01f575 fix: Set size of viewports in onLoad (#2452)
#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.
2023-04-02 17:45:32 +02:00
Jithuraj
2bb894893c feat: Add copy button to code snippets (#2456)
Implement sphinix-copybutton in docs
2023-04-02 14:27:56 +02:00