Commit Graph

3302 Commits

Author SHA1 Message Date
Pasha Stetsenko
914e2f1e65 test: Fix a test for a component with hitboxes (#2299)
In the test, the component was not properly added to a game instance, and as a result its hitbox was never mounted. In addition, the hitbox polygon used negative coordinates, which caused to be outside of the parent shape, which was counterintuitive.
2023-01-27 21:45:04 +00:00
Erick
b4d7e6f7e2 chore: Replace flutter format command (#2297)
flutter format has been deprecated in the last flutter release in favor of dart format.
2023-01-27 14:44:43 +01:00
Erick
b4925423d7 refactor: Simplify how images.dart decodes images (#2293)
* refactor: simplify how images.dart decodes images

* fix tests
2023-01-26 12:26:38 +00:00
Jochum van der Ploeg
74969a50ab chore: Cleaning up padracing example (#2288)
Saw some outdated code in the padracing example, decided to clean it up.
2023-01-26 11:25:33 +00:00
Lukas Klingsbo
6be1c131a3 chore(release): publish packages (#2292)
- flame_audio@1.4.0
2023-01-26 11:48:34 +01:00
Pasha Stetsenko
3b87e838f6 docs: Create "dart" domain extension (#2278)
In Sphinx, there is a concept of a "domain", which enables documenting library object such as classes and functions, and then referencing them from any other place in the documentation. This PR adds such a domain for the Dart language.

With the new approach, a class/function can be documented using the following directive:

```{dartdoc}
📦 flame
:symbol: GameWidget
:file: src/game/game_widget/game_widget.dart
```

The documentation will then be automatically extracted from the referenced file using the dartdoc_json tool (published as a separate package), and then rendered inside the page. The screenshot below shows an example of how DialogueRunner class from Jenny would be rendered:

<image>

Once a symbol has been documented using the dartdoc directive, it can be referenced from other places in the documentation as

{ref}`DialogueRunner`
2023-01-25 21:17:25 +00:00
Alexey Volkov
236a74cef1 fix: Removed component to be deleted from _broadphaseCheckCache (#2282)
The QuadTreeBroadphase._broadphaseCheckCache did not get cleared from removed items and keeps dead components until clear() will be called explicitly.
2023-01-25 21:02:15 +00:00
Lukas Klingsbo
01c3c221e4 chore: Bump audioplayers in flame_audio (#2291) 2023-01-25 20:51:33 +00:00
Alexey Volkov
1819c57590 refactor: Remove "items" variable from core Broadphase class. (#2284)
items variable from core Broadphase class is replaced to abstract getter. Also methods for adding and removing items are added. All this together allows to preserve backward compatibility and allow broadphase / collision detection developer to specify own algorithm of adding/removing hitboxes and algorithm of accessing a full list of hitboxes.
2023-01-25 20:34:34 +00:00
Pasha Stetsenko
263b9dbe02 ci: Added Melos command "doc-setup" (#2281)
The purpose of this new command is to make it easier to install things needed for doc development.
Also added jinja2 into the requirements file -- currently it is installed manually by the doc-publish script (https://github.com/flame-engine/flame-docs-site/blob/main/publish.sh#L58)
2023-01-25 17:58:11 +00:00
Jochum van der Ploeg
04c570b24e chore: Clean up minor code smells (#2289)
Found some minor code smells, wont affect any functionality.
2023-01-25 14:09:14 +00:00
Pasha Stetsenko
c2b75f8b1f ci: Remove lint rule invariant_booleans (#2286)
The rule is deprecated, and is scheduled for removal in a future version of Dart linter: https://dart-lang.github.io/linter/lints/invariant_booleans.html
2023-01-25 13:39:15 +00:00
Pasha Stetsenko
50925f8876 ci: Replace "flutter format" with "dart format" in Melos scripts (#2285)
This fixes the following warning when running our CI workflows:

[!] The "format" command is deprecated and will be removed in a future version of
Flutter. Please use the "dart format" sub-command instead, which takes all of the
same command-line arguments as "flutter format".
2023-01-25 14:29:59 +01:00
Lukas Klingsbo
1566e18b58 ci: Pin flutter version until we have done all fixes (#2290) 2023-01-25 14:19:36 +01:00
Iman Khoshabi
6a818464f5 fix: Override remove() method to fix the functionality issue in the FlameMultiBlocProvider (#2280)
We overrode the add() method in the FlameMultiBlocProvider to handle a new functionality (add the new component to the last provider). We need to apply this functionality to the remove() method too. I just overrode the remove() method to apply that functionality.
In this way, both of add() and remove() methods work consistently.
2023-01-23 13:41:09 +01:00
Lukas Klingsbo
ce7f1110b5 chore(release): Publish packages (#2275)
- flame@1.6.0
 - flame_forge2d@0.12.5
 - flame_jenny@1.0.0
 - flame_rive@1.6.0
 - jenny@1.0.0
 - flame_oxygen@0.1.8
 - flame_bloc@1.8.2
 - flame_isolate@0.2.0
 - flame_lottie@0.2.0
 - flame_test@1.9.2
 - flame_tiled@1.9.1
 - flame_audio@1.3.5
 - flame_flare@1.5.2
 - flame_svg@1.7.1
 - flame_fire_atlas@1.3.3
v1.6.0 1.6.0
2023-01-14 19:59:42 +01:00
Jochum van der Ploeg
2347c8f567 feat: Add a canSee method to the CameraComponent (#2270)
Adding inView method so developers can more easily check if a given component is visible from a camera point of view.
2023-01-14 15:24:08 +00:00
Pasha Stetsenko
6548e9cb0a feat: Added the <<character>> command to Jenny (#2274)
The new command allows pre-declaring the characters that will be seen in the yarn scripts, and provides a place to store any additional information associated with each character.

The DialogueLine.character property now returns a Character object, instead of a String.
2023-01-14 15:42:13 +01:00
Pasha Stetsenko
ab02823fdb chore: Add missing exports for Jenny (#2272)
This ensures that all classes that are documented are actually publicly exported by the package.
2023-01-14 03:48:20 +01:00
Pasha Stetsenko
20fe0e6c26 style: Properly collapse left-side menu on the docs site (#2271)
Currently if you navigate to any inner page on the documentation site, say https://docs.flame-engine.org/main/tutorials/platformer/step_5.html, then the menus on the left that are currently collapsed can be expanded, but those that are already expanded cannot be collapsed (try clicking on the arrow next to "Tutorials" or "Ember Quest"). This PR fixes that.
2023-01-14 00:15:50 +01:00
Jochum van der Ploeg
51e54ebef8 feat: Add moveBy to CameraComponent (#2269)
This PR adds a moveBy method to the CameraComponent using the MoveByEffect, matching the moveTo method we already have.
2023-01-13 17:41:05 +00:00
Pasha Stetsenko
f4b0e73fa1 feat: Added computed property CameraComponent.visibleWorldRect (#2267)
The new property camera.visibleWorldRect gives the Aabb of the world region visible through the camera. This can be useful for culling the render pipeline, or similar purposes.
2023-01-13 14:20:30 +00:00
Pasha Stetsenko
79129e4a72 docs: Update readme for jenny (#2266)
Updating the README, in preparation for the release.
2023-01-13 12:34:10 +00:00
Munsterlander
195680f880 docs: Added note to clarify the use of camera.gameSize in the resize event #2268
This PR addresses the confusion in #2213.
2023-01-13 13:26:04 +01:00
Pasha Stetsenko
f262b7ee39 fix: Jenny now always stringifies whole numbers without .0 (#2265)
The YarnSpinner language supports variables of type numeric, but not integers or doubles. The closest concept in Dart is the num type, which is a union of int and double. However, we need to make sure that a number stringifies in a consistent manner regardless of whether its underlying representation is integer or double. Thus, we must make sure that 12 and 12.0 not only compare equal (which they already do), but also have the same representation when converted to string.

This PR ensures that any integer-like double looks like an integer when converted to a string.
2023-01-12 08:44:42 +00:00
Pasha Stetsenko
f4a309324d test: Added several missing tests for Jenny (#2264)
This adds several missing test cases, restoring 100% coverage.
2023-01-12 09:34:29 +01:00
Pasha Stetsenko
8b57eaa1ab docs: Documentation for markup in Jenny (#2262)
Added documentation for the markup syntax in Jenny.

    Fixed a small bug with spaces surrounding a self-closing markup tag.
2023-01-11 12:06:16 +01:00
Munsterlander
a2772b4e0f feat!: Adds new route methods pushReplacement, pushReplacementNamed, and pushReplacementOverlay (#2249)
This PR adds the aforementioned methods to the router component so a user can replace the current route / overlay with something else without having to call pop then push. Additionally, it corrects an error in the router documents as popPage() does not exist as the call is just pop().
2023-01-10 23:34:59 +01:00
Lukas Klingsbo
736733d913 perf: Avoid Vector2 creation in Sprite.render (#2261)
This creates two new private vector2 objects that can be re-used inside of Sprite.render so that we don't have to create new objects in there.
2023-01-10 11:23:09 +01:00
Pasha Stetsenko
087229ede5 feat: Added if() built-in function in Jenny (#2259)
The if() function can be used in place of a ternary-if operator.
2023-01-09 20:34:32 +01:00
Pasha Stetsenko
ccc6eac199 docs: Add documentation for user-defined functions in Jenny (#2260)
The documentation for user-defined functions and the FunctionStorage class.
2023-01-09 08:30:44 +01:00
Pasha Stetsenko
2eac6f5aa9 docs: Documentation for built-in functions in Jenny (#2258)
This PR adds missing documentation for all built-in functions available in Jenny.

In addition:

    The bool() function now behaves the same way as the conversion of arguments for an invocation of a user-defined function;
    Consequently, static sets trueValues/falseValues moved from CommandStorage class into the YarnProject;
    Added some tests for several other functions.
2023-01-08 22:17:40 +00:00
Lukas Klingsbo
2a0f1d4bdc fix: Only use initialized game for tests and remove setMount from onGameResize (#2246)
Since we used setMounted in onGameResize the mounted feature didn't work properly when invoked from for example onLoad. This PR makes sure that all tests passes without using setMounted in onLoad.

Some GameWidget tests I want a second opinion on, or ideas of how to make those tests better, because when setting mounted explicitly it kind of cheats on part of those tests.
2023-01-08 23:09:19 +01:00
Pasha Stetsenko
69c13568e6 docs: Added documentation for basic expressions in Jenny (#2256)
This PR describes variables and operators in the YarnSpinner language.
2023-01-08 10:53:38 +01:00
Lukas Klingsbo
e373697a93 docs: To -> from zapp link bug issue template (#2255) 2023-01-05 14:11:49 +00:00
Lukas Klingsbo
fe91042323 docs: Add Flame Zapp link to bug issue template (#2253)
Adds a link to https://zapp.run/edit/flame-zh006agh106 in the issue template, since Flame is already set up in there it is incredibly easy to share and run MREs from there.
2023-01-05 13:58:01 +00:00
Lukas Klingsbo
a306338b11 docs: Update example to not create Rect objects (#2254)
We shouldn't teach our users to create new Rect objects in render.
Also switching to onTapDown since onTapUp won't trigger if you move the mouse since it'll be a drag event instead.
2023-01-05 13:45:29 +00:00
Lukas Klingsbo
0412d9b119 chore: Release flame_audio 1.3.4 (#2251)
It bumps audioplayers to 1.2.0
2023-01-03 09:28:22 -05:00
Luke Pighetti
f372952ea2 chore: Bump audioplayers to 1.2.0 (#2250)
Resolves upstream issue bluefireteam/audioplayers#1194
2023-01-03 14:45:15 +01:00
Luan Nico
55bb0afd7a docs: Add warning to version-specific docunmentation pages (#2248)
See details on issue #2214
Basically, we want to make users more aware they are looking at old version of the docs.
2023-01-02 23:58:01 +01:00
Luan Nico
6c5ef0540a docs: Fix broken markdown on docs readme file (#2247)
* doc: Fix broken markdown on docs readme file

* Fix lint
2022-12-31 16:51:35 -05:00
Mahdi Amini
7497631b1f docs: BodyComponents should not be nested (#2242)
Forge2D/Box2D doesn't have a concept of nested bodies and all bodies should live on a top level in the physics world. However, it's hard to know this for people who stat with Forge2d right away. It would be nice to have it clearly mentioned in the documentations.

Closes #2240
2022-12-27 13:02:37 +01:00
Munsterlander
f6593e7a94 docs: References to "your class" to use class name (#2243) 2022-12-27 11:27:40 +01:00
Pasha Stetsenko
a90f90efc5 feat: Added command <<visit>> (#2233)
The functionality of the <<visit Target>> command is that the dialogue runner will temporarily suspend execution of the current node and start executing Target, but then once that finishes it will resume executing the original node.
2022-12-25 18:19:05 +00:00
Pasha Stetsenko
e2ab129e59 feat: OnDialogueChoice now returns null by default (#2234)
Previously, onDialogueChoice was returning a never-completing future, which is both more error-prone, and prevents a use-case where a dialogue view would perform some async action without ultimately making a selection.
2022-12-25 18:07:20 +00:00
Pasha Stetsenko
d898b539f7 refactor!: The method onLoad() now returns FutureOr<void> (#2228)
Before this PR, the return type of onLoad() was Future<void>?, after this PR the return type is FutureOr<void> -- both for classes Component and Game.

Reasons:

The use of FutureOr is more idiomatic in Dart, this class was specifically created in order to be used in situations like ours.
This makes learning Flame easier for beginners, since you no longer need to explain what asynchronous programming is from the start (and onLoad() is one of the first methods the user encounters in Flame).
The code can be cleaner in case when onLoad doesn't need to be async.
With new approach, the onLoad() method can be overridden as either

@override
Future<void> onLoad() async { ... }
or

@override
void onLoad() { ... }
Of course, it can also be overridden as

@override
FutureOr<void> onLoad() { ... }
but this is rare, only for components that are designed to be further subclassed, or for mixins.

The documentation was updated to show the new recommended usage.
2022-12-23 20:30:40 +00:00
Pasha Stetsenko
19a1f09acc feat: Added DialogueView.onNodeFinish event (#2229)
The onNodeFinish event is a counterpart to onNodeStart.
    This also fixes a small bug where node visit count was not properly incremented if the node was exited via a <<stop>>.
    The DialogueRunner.runNode() method renamed into startDialogue().
2022-12-23 00:02:44 +00:00
Pasha Stetsenko
934585321f docs: Documentation for built-in commands in Jenny (#2231)
This adds/updates documentation for all built-in commands in Jenny.
2022-12-23 00:54:11 +01:00
Pasha Stetsenko
2e646b7fbc fix title validator (#2230) 2022-12-22 00:34:39 +01:00
Pasha Stetsenko
d50585f9c7 ci: Add list of conventional commit prefixes (#2227)
Include the list of allowed Conventional Commit prefixes into the PR template, and into the title validator action; otherwise this information is too hard to hunt down (https://github.com/commitizen/conventional-commit-types/blob/master/index.json)
The title validator now checks that the PR title starts with a capital letter.
Removed checklist item "The title of my PR starts with a Conventional Prefix", since this is now enforced automatically.
2022-12-21 20:53:10 +01:00