Line data Source code
1 : import 'dart:ui'; 2 : 3 : import 'package:meta/meta.dart'; 4 : 5 : import '../extensions/vector2.dart'; 6 : import '../nine_tile_box.dart'; 7 : import 'position_component.dart'; 8 : 9 : export '../nine_tile_box.dart'; 10 : 11 : /// This class is a thin wrapper on top of [NineTileBox] as a component. 12 : class NineTileBoxComponent extends PositionComponent { 13 : NineTileBox nineTileBox; 14 : 15 : /// Takes the [NineTileBox] instance used to render this box. 16 : /// 17 : /// It uses the x, y, width and height coordinates from the [PositionComponent] to render. 18 0 : NineTileBoxComponent( 19 : this.nineTileBox, { 20 : Vector2? position, 21 : Vector2? size, 22 : int? priority, 23 0 : }) : super(position: position, size: size, priority: priority); 24 : 25 0 : @mustCallSuper 26 : @override 27 : void render(Canvas c) { 28 0 : super.render(c); 29 0 : nineTileBox.drawRect(c, size.toRect()); 30 : } 31 : }