formatting

This commit is contained in:
Luan Nico
2019-09-21 13:04:02 -04:00
parent e2622cde41
commit 11a479cf24
5 changed files with 15 additions and 16 deletions

View File

@ -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();
} }

View File

@ -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() {

View File

@ -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) {}

View File

@ -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) {}