Skip to content

Commit 5d1a6fd

Browse files
authoredMay 5, 2023
1 parent 55ec0bc commit 5d1a6fd

30 files changed

+9425
-30
lines changed
 

‎.github/.cspell/flame_dictionary.txt

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ erayzesen
2222
padracing
2323
ptero
2424
riverpod
25+
spineboy
26+
spineboys
2527
spydon
2628
stpasha
2729
tavian

‎.github/cspell.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"\\$\\w+",
1414
"\\{\\w+",
1515
"\\`\\w+",
16+
"\\.\\w+",
1617
"\\:\\w+",
1718
"\\/\\w+",
1819
"\\#[\\w\\-]+"
@@ -39,14 +40,14 @@
3940
"addWords": true
4041
},
4142
{
42-
"name": "gamedev_dictionary",
43-
"path": "./.cspell/gamedev_dictionary.txt",
44-
"addWords": true
43+
"name": "gamedev_dictionary",
44+
"path": "./.cspell/gamedev_dictionary.txt",
45+
"addWords": true
4546
},
4647
{
47-
"name": "sphinx_dictionary",
48-
"path": "./.cspell/sphinx_dictionary.txt",
49-
"addWords": true
48+
"name": "sphinx_dictionary",
49+
"path": "./.cspell/sphinx_dictionary.txt",
50+
"addWords": true
5051
}
5152
]
5253
}

‎doc/bridge_packages/bridge_packages.md

+24-11
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ A Box2D physics engine (bridge package for [Forge2D]).
2525
Use isolates to offload heavy computations to another thread.
2626
:::
2727

28+
:::{package} flame_lottie
29+
30+
Use Lottie animations in Flame (bridge package for [Lottie]).
31+
:::
32+
2833
:::{package} flame_network_assets
2934

3035
Fetch assets over the network.
@@ -40,6 +45,11 @@ Replace FCS with the Oxygen Entity Component System.
4045
Create interactive animations (bridge package for [Rive]).
4146
:::
4247

48+
:::{package} flame_spine
49+
50+
Use Spine skeletal animations (bridge package for [Spine]).
51+
:::
52+
4353
:::{package} flame_splash_screen
4454

4555
Add the "Powered by Flame" splash screen.
@@ -59,24 +69,27 @@ Draw SVG files in Flutter (bridge package for [flutter_svg]).
5969
[Bloc]: https://github.com/felangel/bloc
6070
[FireAtlas]: https://github.com/flame-engine/fire-atlas
6171
[Forge2D]: https://github.com/flame-engine/forge2d
72+
[Lottie]: https://pub.dev/packages/lottie
6273
[Rive]: https://rive.app/
74+
[Spine]: https://pub.dev/packages/spine_flutter
6375
[Tiled]: https://www.mapeditor.org/
6476
[flutter_svg]: https://github.com/dnfield/flutter_svg
6577

6678

6779
```{toctree}
6880
:hidden:
6981
70-
flame_audio <flame_audio/flame_audio.md>
71-
flame_bloc <flame_bloc/flame_bloc.md>
72-
flame_fire_atlas <flame_fire_atlas/flame_fire_atlas.md>
73-
flame_forge2d <flame_forge2d/flame_forge2d.md>
74-
flame_isolate <flame_isolate/flame_isolate.md>
75-
flame_lottie <flame_lottie/flame_lottie.md>
82+
flame_audio <flame_audio/flame_audio.md>
83+
flame_bloc <flame_bloc/flame_bloc.md>
84+
flame_fire_atlas <flame_fire_atlas/flame_fire_atlas.md>
85+
flame_forge2d <flame_forge2d/flame_forge2d.md>
86+
flame_isolate <flame_isolate/flame_isolate.md>
87+
flame_lottie <flame_lottie/flame_lottie.md>
7688
flame_network_assets <flame_network_assets/flame_network_assets.md>
77-
flame_oxygen <flame_oxygen/flame_oxygen.md>
78-
flame_rive <flame_rive/flame_rive.md>
79-
flame_splash_screen <flame_splash_screen/flame_splash_screen.md>
80-
flame_svg <flame_svg/flame_svg.md>
81-
flame_tiled <flame_tiled/flame_tiled.md>
89+
flame_oxygen <flame_oxygen/flame_oxygen.md>
90+
flame_rive <flame_rive/flame_rive.md>
91+
flame_splash_screen <flame_splash_screen/flame_splash_screen.md>
92+
flame_spine <flame_spine/flame_spine.md>
93+
flame_svg <flame_svg/flame_svg.md>
94+
flame_tiled <flame_tiled/flame_tiled.md>
8295
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# flame_spine
2+
3+
This package allows you to load and add Spine skeletal animations to your Flame game.
4+
5+
6+
## Usage
7+
8+
To use it in your game you just need to add `flame_spine` to your pubspec.yaml and your spine
9+
assets to your `assets/` directory, and you can add a `SpineComponent` to your `FlameGame`.
10+
11+
```{note}
12+
Remember to call `await initSpineFlutter();` in your `main` method, or in `onLoad`.
13+
```
14+
15+
Example:
16+
17+
```dart
18+
void main() async {
19+
WidgetsFlutterBinding.ensureInitialized();
20+
await initSpineFlutter();
21+
runApp(const GameWidget.controlled(gameFactory: SpineExample.new));
22+
}
23+
24+
class FlameSpineExample extends FlameGame with TapDetector {
25+
late final SpineComponent spineboy;
26+
27+
@override
28+
Future<void> onLoad() async {
29+
await initSpineFlutter();
30+
// Load the Spineboy atlas and skeleton data from asset files
31+
// and create a SpineComponent from them, scaled down and
32+
// centered on the screen
33+
spineboy = await SpineComponent.fromAssets(
34+
atlasFile: 'assets/spine/spineboy.atlas',
35+
skeletonFile: 'assets/spine/spineboy-pro.skel',
36+
scale: Vector2(0.4, 0.4),
37+
anchor: Anchor.center,
38+
position: size / 2,
39+
);
40+
41+
// Set the "walk" animation on track 0 in looping mode
42+
spineboy.animationState.setAnimationByName(0, 'walk', true);
43+
await add(spineboy);
44+
}
45+
46+
@override
47+
void onDetach() {
48+
// Dispose the native resources that have been loaded for spineboy.
49+
spineboy.dispose();
50+
}
51+
}
52+
```

‎examples/assets/spine/LICENSE

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Copyright (c) 2013, Esoteric Software
2+
3+
The images in this project may be redistributed as long as they are accompanied
4+
by this license file. The images may not be used for commercial use of any
5+
kind.
6+
7+
The project file is released into the public domain. It may be used as the basis
8+
for derivative work.

0 commit comments

Comments
 (0)
Please sign in to comment.