mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 01:18:38 +08:00
* 👌 Use `Offset` type directly in `JoystickAction.update` calculations (#631) * Move files to src and comply with the dart package layout convention * Fixing widgets example Co-authored-by: Serge Matveenko <lig@countzero.co> Co-authored-by: Erick Zanardo <erickzanardoo@gmail.com>
21 lines
425 B
Dart
21 lines
425 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:flame/components.dart';
|
|
|
|
class Square extends PositionComponent {
|
|
final Paint _paint;
|
|
|
|
Square(this._paint, Vector2 position, {double angle = 0.0}) {
|
|
size = Vector2.all(100.0);
|
|
this.position = position;
|
|
this.angle = angle;
|
|
anchor = Anchor.center;
|
|
}
|
|
|
|
@override
|
|
void render(Canvas canvas) {
|
|
super.render(canvas);
|
|
canvas.drawRect(size.toRect(), _paint);
|
|
}
|
|
}
|