Skip to content

Commit

Permalink
feat: improving generics on position body component (#1397)
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzanardo authored Feb 28, 2022
1 parent 102a27c commit 7edbb29
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/flame_forge2d/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
sdk: flutter
flame_forge2d:
path: ../
dashbook: ^0.1.5
dashbook: ^0.1.6

dev_dependencies:
flutter_test:
Expand Down
6 changes: 3 additions & 3 deletions packages/flame_forge2d/lib/position_body_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import 'forge2d_game.dart';
/// [PositionComponent] and it can only have its anchor in the center.
/// You can initialize it either by sending in a [PositionComponent] and a
/// [size] in the constructor, or set those fields in [onLoad].
abstract class PositionBodyComponent<T extends Forge2DGame>
extends BodyComponent<T> {
PositionComponent? positionComponent;
abstract class PositionBodyComponent<T extends Forge2DGame,
P extends PositionComponent> extends BodyComponent<T> {
P? positionComponent;
final Vector2? _size;
Vector2 get size => _size!;

Expand Down
2 changes: 1 addition & 1 deletion packages/flame_forge2d/lib/sprite_body_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'forge2d_game.dart';
import 'position_body_component.dart';

abstract class SpriteBodyComponent<T extends Forge2DGame>
extends PositionBodyComponent<T> {
extends PositionBodyComponent<T, SpriteComponent> {
/// Make sure that the [size] of the sprite matches the bounding shape of the
/// body that is create in createBody()
SpriteBodyComponent(
Expand Down

0 comments on commit 7edbb29

Please sign in to comment.