mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
formatting
This commit is contained in:
@ -76,13 +76,13 @@ mixin ComposedComponent on Component, HasGameRef, Tapeable {
|
|||||||
|
|
||||||
// Finds all children of type T, recursively
|
// Finds all children of type T, recursively
|
||||||
Iterable<T> _findT<T>() => components.expand((c) {
|
Iterable<T> _findT<T>() => components.expand((c) {
|
||||||
final List<T> r = [];
|
final List<T> r = [];
|
||||||
if (c is T) {
|
if (c is T) {
|
||||||
r.add(c as T);
|
r.add(c as T);
|
||||||
}
|
}
|
||||||
if (c is ComposedComponent) {
|
if (c is ComposedComponent) {
|
||||||
r.addAll(c._findT<T>());
|
r.addAll(c._findT<T>());
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}).cast();
|
}).cast();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,4 +2,4 @@ import '../../game.dart';
|
|||||||
|
|
||||||
mixin HasGameRef<T extends Game> {
|
mixin HasGameRef<T extends Game> {
|
||||||
T gameRef;
|
T gameRef;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,7 +111,8 @@ abstract class BaseGame extends Game {
|
|||||||
/// List of deltas used in debug mode to calculate FPS
|
/// List of deltas used in debug mode to calculate FPS
|
||||||
final List<double> _dts = [];
|
final List<double> _dts = [];
|
||||||
|
|
||||||
Iterable<Tapeable> get _tapeableComponents => components.where((c) => c is Tapeable).cast();
|
Iterable<Tapeable> get _tapeableComponents =>
|
||||||
|
components.where((c) => c is Tapeable).cast();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onTapCancel() {
|
void onTapCancel() {
|
||||||
|
|||||||
@ -30,8 +30,8 @@ class MyTap extends PositionComponent with Tapeable, Resizable {
|
|||||||
bool checkTapOverlap(Offset o) => true;
|
bool checkTapOverlap(Offset o) => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyComposed extends Component with HasGameRef, Tapeable, ComposedComponent {
|
class MyComposed extends Component
|
||||||
|
with HasGameRef, Tapeable, ComposedComponent {
|
||||||
@override
|
@override
|
||||||
void update(double dt) {}
|
void update(double dt) {}
|
||||||
|
|
||||||
|
|||||||
@ -14,10 +14,8 @@ class MyGame extends BaseGame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyComponent extends PositionComponent with HasGameRef<MyGame> {
|
class MyComponent extends PositionComponent with HasGameRef<MyGame> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void update(double dt) {
|
void update(double dt) {}
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void render(Canvas c) {}
|
void render(Canvas c) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user