Adding Animation#paint

This commit is contained in:
Erick Zanardo
2020-04-01 21:36:29 -03:00
parent e19f87046c
commit 2c705ebcee
2 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@
- Adding Component#onDestroy - Adding Component#onDestroy
- Adding Keyboard events API - Adding Keyboard events API
- Adding Box2DGame, an extension of BaseGame to simplify lifecycle of Box2D components - Adding Box2DGame, an extension of BaseGame to simplify lifecycle of Box2D components
- Adding AnimationComponent#paint
## 0.18.2 ## 0.18.2
- Add loop for AnimationComponent.sequenced() (thanks @wenxiangjiang) - Add loop for AnimationComponent.sequenced() (thanks @wenxiangjiang)

View File

@ -5,6 +5,7 @@ import 'package:flame/animation.dart';
class AnimationComponent extends PositionComponent { class AnimationComponent extends PositionComponent {
Animation animation; Animation animation;
Paint paint;
bool destroyOnFinish = false; bool destroyOnFinish = false;
AnimationComponent(double width, double height, this.animation, AnimationComponent(double width, double height, this.animation,
@ -53,7 +54,7 @@ class AnimationComponent extends PositionComponent {
@override @override
void render(Canvas canvas) { void render(Canvas canvas) {
prepareCanvas(canvas); prepareCanvas(canvas);
animation.getSprite().render(canvas, width: width, height: height); animation.getSprite().render(canvas, width: width, height: height, overridePaint: paint);
} }
@override @override