Part 3: Great Composed Component Refactor

This commit is contained in:
Luan Nico
2020-08-08 19:49:10 -04:00
parent 23f13c395a
commit 997f36edc4
31 changed files with 388 additions and 302 deletions

View File

@ -23,14 +23,17 @@ class Palette {
class Square extends PositionComponent with HasGameRef<MyGame> {
static const SPEED = 0.25;
static Paint white = Palette.white.paint;
static Paint red = Palette.red.paint;
static Paint blue = Palette.blue.paint;
@override
void render(Canvas c) {
prepareCanvas(c);
super.render(c);
c.drawRect(Rect.fromLTWH(0, 0, width, height), Palette.white.paint);
c.drawRect(const Rect.fromLTWH(0, 0, 3, 3), Palette.red.paint);
c.drawRect(Rect.fromLTWH(width / 2, height / 2, 3, 3), Palette.blue.paint);
c.drawRect(toZeroRect(), white);
c.drawRect(const Rect.fromLTWH(0, 0, 3, 3), red);
c.drawRect(Rect.fromLTWH(width / 2, height / 2, 3, 3), blue);
}
@override