Commit Graph

3302 Commits

Author SHA1 Message Date
Munsterlander
0a1ec182b6 fix: Fixed doc autobuild on windows (#2083) 2022-10-15 13:59:04 +02:00
Lukas Klingsbo
7e378f4135 docs: Fix documentation auto build (#2082) 2022-10-14 23:51:00 +00:00
sumit kumar
a34f1df790 feat: Added toString method to all the drags events message handlers (#2014)
Added toString method to all Drag Event message Handlers in flame/lib/src/events/messages/ which were returning pure data objects and were not much meaningful
2022-10-14 10:49:25 +00:00
Shweta Chauhan
a1f4af9c3c test: unit test for HasHoverables (#2074)
- 🚨 unit test for `HasHoverables`

Co-authored-by: Shweta_C <shweta.c@simformsolutions.com>
Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
2022-10-14 08:17:49 +00:00
Dipak Prajapati
3549891d9d test: Unit tests for gesture detectors (#2071)
Unit tests for gesture detectors #2019
2022-10-14 08:10:36 +00:00
Anas35
a3a65f30ab fix: Fixed null exception when no artboard with specified name is exists (#2069)
Fixed null exception when no artboard with specified name is exists and added necessary test.
2022-10-13 15:39:29 +02:00
Shweta Chauhan
d659b85d09 fix: 🐛 unit test for Forge2dGame (#2068)
- Working on unit test

Co-authored-by: Shweta_C <shweta.c@simformsolutions.com>
2022-10-13 14:37:31 +02:00
Matt Bennett
62c5c2e144 fix: solid circles and polygons intersection (#2067)
This PR fixes polygons inside a solid circle and circles inside a solid polygon not being correctly detected.
(This relates to Flame's collision detection, not Forge2D)
2022-10-12 09:48:16 +02:00
Anas35
202d809b7f test: Added test for rive_component (#2065)
Added some basic test for rive_component.

More test will be added in the follow up PR that fix rive_component's issue.
2022-10-11 18:49:32 +00:00
Pasha Stetsenko
b3b673011c refactor: OpacityEffect now uses opacity instead of alpha internally (#2064)
Using opacity instead of integer alpha simplifies the code (and also reduces round-off errors which may accumulate for longer-running effects).
2022-10-11 16:15:34 +00:00
Dipak Prajapati
1b97747a17 test: Unit tests for component mixins (#2041) 2022-10-11 18:07:23 +02:00
Munsterlander
db57a47230 docs: flame_tiled bridge package documentation (#2050) 2022-10-11 15:28:56 +00:00
Sai Rajendra Immadi
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
Matt Bennett
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
Bishwajeet Parhi
15ba72c4d5 docs: Add interactive docs for OpacityEffect (#2054)
Add interactive docs for OpacityEffect.
2022-10-10 11:03:02 +00:00
sccalabr
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
DevKage
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
DevKage
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
Pasha Stetsenko
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
Shweta Chauhan
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
Pasha Stetsenko
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
Munsterlander
dfb94d1a34 fix: Audio Fixed for live examples (#2044) 2022-10-08 12:59:13 +02:00
Pasha Stetsenko
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
Shweta Chauhan
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
Shweta Chauhan
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
DevKage
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
Lukas Klingsbo
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
Sai Rajendra Immadi
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
Munsterlander
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
Alexey Pyltsyn
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
Shweta Chauhan
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
ayroti dey sarkar
475b226911 docs: Fixed broken example links (#2030) 2022-10-06 10:15:32 +02:00
John McDole
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
Munsterlander
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
Aatmaj
0ee9898b86 docs: Fixed some grammer issues in README.md (#2027) 2022-10-05 21:44:27 +02:00
Pasha Stetsenko
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
Valentin Treu
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
Munsterlander
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
Lukas Klingsbo
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
Munsterlander
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
Shweta Chauhan
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
Quentin Klein
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
Shweta Chauhan
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
Quentin Klein
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
Sai Rajendra Immadi
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
Munsterlander
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
ayroti dey sarkar
c6bea2064d docs: Pin doc dependency versions (#2008) 2022-10-03 19:31:02 +00:00
Pasha Stetsenko
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
Shweta Chauhan
45a9d79bc4 fix: SpriteButtonComponent missing @mustCallSuper added (#2001) 2022-10-03 13:26:39 +02:00
Munsterlander
b720657187 docs: Updated the required python version (#1991) 2022-10-02 20:31:54 +02:00