Line data Source code
1 : import 'dart:ui'; 2 : 3 : import '../sprite_batch.dart'; 4 : import 'component.dart'; 5 : 6 : class SpriteBatchComponent extends Component { 7 : SpriteBatch? spriteBatch; 8 : BlendMode? blendMode; 9 : Rect? cullRect; 10 : Paint? paint; 11 : 12 : /// Creates a component with an empty sprite batch which can be set later 13 0 : SpriteBatchComponent(); 14 : 15 0 : SpriteBatchComponent.fromSpriteBatch( 16 : this.spriteBatch, { 17 : this.blendMode, 18 : this.cullRect, 19 : this.paint, 20 : }); 21 : 22 0 : @override 23 : void render(Canvas canvas) { 24 0 : spriteBatch?.render( 25 : canvas, 26 0 : blendMode: blendMode, 27 0 : cullRect: cullRect, 28 0 : paint: paint, 29 : ); 30 : } 31 : }