2692 Commits

Author SHA1 Message Date
1b97747a17 test: Unit tests for component mixins (#2041) 2022-10-11 18:07:23 +02:00
db57a47230 docs: flame_tiled bridge package documentation (#2050) 2022-10-11 15:28:56 +00:00
8b3ea08c39 docs: fix move effect interactive examples reset (#2060)
This commit fixes the interactive examples of move effect (by and along
path). The were not coming to their original position. This commit fixes
the flower to come to original position when clicked 2nd time. This also
arranges the code in multi line for the move effects in documentation.
2022-10-11 17:23:27 +02:00
8cd4793ac2 fix!: PolygonComponent no longer modifies _vertices (#2061)
* fix!: PolygonComponent no longer modifies _vertices

_vertices passed as first parameter to PolygonComponent constructor
was modified by offsetting all values by the _topLeft vector. This
fix offsets the vectors on demand, so original data is not changed.

Breaking change as PolygonComponent .vertices getter no longer
includes this offset.

* Fixed contains point and intersections.

topLeft offset was being incorrectly applied to globalVertices.
Made topLeft public with @internal to allow its use in CirclePolygonIntersections class.
Public visibility of topLeft also allows previous behaviour of PolygonComponent .vertices to be reproduced by subtracting .topLeft vector from all vectors in new .vertices values.
2022-10-10 22:54:56 +02:00
15ba72c4d5 docs: Add interactive docs for OpacityEffect (#2054)
Add interactive docs for OpacityEffect.
2022-10-10 11:03:02 +00:00
fae56a074b docs: Move Effects Examples (#2052)
The three MoveEffects should have small examples that show how the effect is applied and how it works. This could for example be just clicking somewhere in the game and moving a geometrical shape to the position where the reader clicked.
2022-10-09 17:31:53 +00:00
fe9d4d9bfb fix: OpacityEffect custom paint override (#2056)
When applying OpacityEffect to a specific paintId, the paint at that id was accidently getting replaced with the default paint. This PR makes sure that color from the provided paintId is used while modifying alpha and opacity in HasPaint mixin.
2022-10-09 16:39:05 +00:00
fc0435d870 test: Windows specific test failures (#1975)
This PR modifies the Vector2.scaleTo test to use expectDouble instead of expect so as to account for the minor deviation in floating point math.

For the second test, elapsed time of sprite animation was reported as 0.0 after pump() in some cases, causing the test to fail. Even on Linux the elapsed value turns out to be quite small but never reaches zero. For some reason the animation gets reset quite a few time for each pump, causing the elapsed time to get reset to 0. This PR changes the test to check if the animation has started instead of checking is elapsed is non-zero.
2022-10-09 18:23:36 +02:00
b46c390ab2 docs: Link CONTRIBUTING file into the docs (#2051)
As discussed in #2045, this PR makes the CONTRIBUTING doc also visible from the main documentation site.
2022-10-09 13:43:34 +02:00
25f3f721e7 test: Widget tests for Event Mixin (#2048)
Widget test for DragCallbacks and TapCallbacks
    Added some common function in separate file for common use case
    Minor test case description changed for MultiTouchTapDetector
2022-10-08 17:53:08 +02:00
b5780d4212 feat: Add support for styles propagating through the text node tree (#1915)
This PR continues the work for enabling rich text support within Flame.
Here I add support for different text fragments having different TextStyles, and allow those styles to be inheritable within the text node tree.
2022-10-08 11:08:18 +00:00
dfb94d1a34 fix: Audio Fixed for live examples (#2044) 2022-10-08 12:59:13 +02:00
a0d7eadae4 feat: Added SpriteFont class (#1992)
This PR adds the SpriteFont class, which encapsulates reusable information about a sprite font. Text renderers / text formatters can be created based on this SpriteFont.

In addition:

    GlyphInfo removed (was internal), and GlyphData deprecated -- instead, there is now a consolidated Glyph class;
    Sprite font now supports extended Unicode characters and ligatures (when a combination of letters is represented as a single glyph)
        This feature can also be used to define simple name substitutions. For example, you can declare that "[gp]" or "&gp;" would represent a gold coin icon;
    Sprite font supports variable-width fonts;
    Sprite font supports glyphs where the source rect is different from the logical rect;
    Sprite font renderer can now control the color of the text rendered.
2022-10-07 14:59:09 +00:00
7f546b0f13 fix: #2017 (#2039)
-  Unit and Widget tests for Event Mixin
    - `DragCallbacks`
    - `TapCallbacks`
    - `MultiTouchDragDetector`
    - `MultiTouchTapDetector`

Co-authored-by: Shweta_C <shweta.c@simformsolutions.com>
2022-10-07 16:51:23 +02:00
4d513311fd test : Widget test for SpriteButtonComponent (#2040)
- 🚨 Widget test for `SpriteButtonComponent`

Co-authored-by: Shweta_C <shweta.c@simformsolutions.com>
2022-10-07 12:22:21 +00:00
6b78b10fb3 feat: Add optional maxDistance to raycast (#2012)
This PR adds an optional parameter to raycast API called maxDistance. Using this parameter users can control the limit within which raycast scans for hits.
2022-10-07 14:13:42 +02:00
ec817c2334 ci: Fix conventional commit title validation (#2038)
The conventional commit title validation wasn't running automatically when the contributor updated the title, this fixes so that it does.
2022-10-07 07:38:55 +00:00
88c3177c17 docs: make the language tag non moving in code blocks (#2035)
This commit makes a few css style changes in order that the language tags for code blocks in documentation site remains same even when horizontally scrolled.

Along with the above, this commit adds right padding to the code as to not come under the language tag when reaching the end.
2022-10-07 08:12:37 +02:00
7b47ce1fd0 docs: Added rotate effect example and fixed multi-line (#2024)
Added rotate effect and tested working. Effect resets.
2022-10-06 14:59:42 +00:00
ccba5a14b2 docs: Wrap long external links to avoid horizontal scrolling (#2034)
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2022-10-06 14:33:56 +00:00
c26d5da373 fix: Event mixins missing @mustCallSuper (#2036)
- 🐛 Event mixins missing `@mustCallSuper`

Co-authored-by: Shweta_C <shweta.c@simformsolutions.com>
2022-10-06 16:27:19 +02:00
475b226911 docs: Fixed broken example links (#2030) 2022-10-06 10:15:32 +02:00
bc2db2b17a TiledAtlas (#1982)
Allocate an atlas per map to keep sprite paint orders correct.  If you
already use one atlas permap, this will have no benifit. Multiple
tileset images will see both a performance gain from single batch
renders, and correct painting on staggered maps.

Fix animations with offets
- Remove TiledLayer._loadImages - no longer used.
- Animations that are in other layers need also translate by offset

Cheap 2D rect bin packing
- Sort: images from large->small
- Keep searching for smallest rect, but input rects should be big->small

Parallel load atlas images

Moved some testing classes around for better code sharing

Fixed tests for external tsx loading. It is dangerous to override global
static values...

Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2022-10-06 05:53:06 +00:00
a67dec39f7 docs: Added links to API and Examples in doc sidebar (#1997)
Based on a brief discussion with Spydon, this adds two links in the docs sidebar to API docs on pub.dev as well as a link to the flame examples.
2022-10-05 21:15:15 +00:00
0ee9898b86 docs: Fixed some grammer issues in README.md (#2027) 2022-10-05 21:44:27 +02:00
a956350b78 docs: Fix documentation markup errors (#2022)
Fix several errors reported during documentation build.
Generally speaking,

```foo

would be interpreted as a code block with the language foo; while

```{foo}

would be interpreted as a Sphinx directive .. foo.
2022-10-05 08:02:20 +00:00
3d043b86f7 feat: Adding onChildrenChanged (#1976)
In order to get notified about a change in a parent's children this new function will be called now.
This feature will help simplifying e.g. the implementation of issue #1944 (Row and Column components).
2022-10-04 21:26:22 +00:00
95a3524664 docs: Sequence effect (#1993)
Addresses: #1954

Adds the interactive example. There is an issue with OpacityEffect in a Sequence so it was omitted.
2022-10-04 21:13:57 +00:00
07f7515f31 ci: Inline analyze warnings (#2020)
This helps our contributors to see the warnings from the analyzer directly in the PR.
2022-10-04 20:59:49 +00:00
c7494eb06e docs: Anchor effects (#1989)
In response to issue: #1953

This adds two simple interactive examples for anchors.
2022-10-04 17:35:08 +02:00
62cc12c738 test: Unit tests for SpriteButtonComponent (#2015)
🐛 fix: Unit tests for SpriteButtonComponent #1967 : Unit tests for SpriteButtonComponent
2022-10-04 16:49:48 +02:00
801c683c6c fix: Change Vector2.zero() to Vector2(0, -1) in Vector2Extensions.fromRadians() (#2016)
As seen in #2009 there is an issue in Vector2Extensions

/// Creates a heading [Vector2] with the given angle in radians.
static Vector2 fromRadians(double r) => Vector2.zero()..rotate(r);

/// Creates a heading [Vector2] with the given angle in degrees.
static Vector2 fromDegrees(double d) => fromRadians(d * degrees2Radians);

But this does nothing as the rotate method does nothing on zero

void rotate(double angle, {Vector2? center}) {
    if (isZero() || angle == 0) {
      // No point in rotating the zero vector or to rotate with 0 as angle
      return;
    }
    ...
}

Solution : Change Vector2.zero() to Vector2(0, -1) in Vector2Extensions.fromRadians
Also added unit tests to make sure it works fine.
2022-10-04 14:32:55 +00:00
f63711dc56 fix: #1998 (#2013)
- 🐛 Unit tests for AssetsCache

Co-authored-by: Shweta_C <shweta.c@simformsolutions.com>
2022-10-04 13:47:37 +00:00
8b26ecd0f7 test: Add tests on flame/extensions (#2009)
I've added multiple unit tests on flame/extensions files.
The coverage on extensions is now (almost) 100%
2022-10-04 13:30:56 +00:00
24a1ed22cc docs: add scale effect interactive examples (#2004)
This commit adds Scale Effect Interactive Examples in the documentation (ScaleEffect.by and ScaleEffect.to)
2022-10-04 13:01:57 +00:00
3796c5cfb0 docs: Collision interactive examples (#2010)
Also, I created a new component based on Spydon's request. Ember is now an extendable class for these examples. You can override the onTap method and I suspect we can extend collision or any other method that is needed for more interactive examples.
2022-10-04 14:47:06 +02:00
c6bea2064d docs: Pin doc dependency versions (#2008) 2022-10-03 19:31:02 +00:00
12ce270b9b feat: Added HasGameReference mixin (#1828)
This almost exactly like the current HasGameRef mixin, except that:

    The property is called game instead of gameRef (the "gameRef" violates Dart naming conventions against using abbreviations in variable names);
    The template type T supports all Games, not only FlameGames;
    Better integration with the SingleGameInstance mixin;
    The new mixin is within experimental, to reduce chance that it will confuse the users.
2022-10-03 15:29:02 +00:00
45a9d79bc4 fix: SpriteButtonComponent missing @mustCallSuper added (#2001) 2022-10-03 13:26:39 +02:00
b720657187 docs: Updated the required python version (#1991) 2022-10-02 20:31:54 +02:00
9da9a6a756 docs: Mermaid diagrams parsing fix and removed black arrow (#1987)
* added mermaid diagrams for components, lifecycle-components and low-level-game-api

removed graph images

* fixed markdown lints

* Apply suggestions from code review

* missing parenthesis around mermaid added

* removed black arrow from diagram

Co-authored-by: dipak <dipak.prajapati@bacancy.com>
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
2022-10-02 15:47:23 +02:00
ed2aeca388 docs: Mermaid diagrams (#1986)
Added mermaid diagrams for components, lifecycle-components and low-level-game-api added
    removed graph images for above diagrams
2022-10-02 12:45:53 +00:00
8b56c5477b fix: Ignore the build directories for sphinx builds (#1984)
If we don't ignore the build directories it will build multiple times unnecessarily when doing the live build.
1.4.0
2022-10-02 06:45:41 -04:00
ed9890af11 fix: Melos sphinx scripts windows (#1985)
melos doc-xyz commands were not working on Windows as SOURCEDIR was not properly getting set. I tried changing it to use set SOURCEDIR="$MELOS_ROOT_PATH/doc" and set SOURCEDIR="%MELOS_ROOT_PATH%/doc", but both didn't work. As SOURCEDIR isn't really necessary to be set for the commands to work, this PR remove that variable and directly using $MELOS_ROOT_PATH/doc in its place.

Additionally, this PR also adds .venv (a common folder storing virtual env) to gitignore.
2022-10-02 09:35:23 +00:00
f840210bf9 feat: onComponentTypeCheck support for ShapeHitbox (#1981)
onComponentTypeCheck was only supported for components but not for hitboxes, because ShapeHitbox implements GenericCollisionCallbacks instead CollisionCallbacks.

Specifying onComponentTypeCheck for individual hitboxes might be useful in cases where Component have hitboxes for collisions and also some utility hitboxes (for example, to check available directions for pathfinding). Colliding between this two types of hitboxes should not lead to movement restrictions and so on. But without onComponentTypeCheck in ShapeHitbox we can not to perform such check.
v1.4.0
2022-10-01 23:38:43 +02:00
2ed1403560 fix: Use flutter.bat on Windows (#1979)
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2022-10-01 13:48:26 +00:00
755bc64bcb chore: Add deprecation instructions to changelog 2022-10-01 15:29:55 +02:00
3b056c57c5 chore(release): publish packages
- flame@1.4.0
 - flame_test@1.8.0
 - flame_oxygen@0.1.6
 - flame_bloc@1.8.0
 - flame_flare@1.5.0
 - flame_forge2d@0.12.3
 - flame_lint@0.1.3
 - flame_svg@1.6.0
 - flame_tiled@1.8.0
 - flame_rive@1.5.2
 - flame_audio@1.3.2
 - flame_fire_atlas@1.3.1
2022-10-01 15:22:41 +02:00
f3aaacb9bc chore: Remove deprecations for v1.4.0 (#1978)
Just removes all the methods and classes that should be removed for v1.4.0
2022-10-01 13:16:46 +00:00
50d4482dc6 docs: Update docs about how to build the docs (#1970)
* docs: Update docs about how to build the docs

* Change name on sphinx targets

* Add doc-live-build
2022-09-30 19:03:04 +00:00