mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-30 08:27:36 +08:00
Final tweaks to prepare merging flame_3d. As can be seen [on the merge PR](https://github.com/flame-engine/flame/pull/3377), we are almost ready to have a nice diff to merge. This fixes a couple final issues: * the `.4 -> 0.4` thing that I had copied from main before merging my fix into main (this will "untouch" that file from the main diff) * the min flutter version as set by `melos bs` on the flame_3d package itself
31 lines
709 B
Dart
31 lines
709 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:flame/components.dart';
|
|
import 'package:flame/game.dart';
|
|
|
|
class ResizingRectangle extends RectangleComponent {
|
|
ResizingRectangle()
|
|
: super(
|
|
paint: Paint()..color = const Color(0xFFFE4813),
|
|
);
|
|
|
|
@override
|
|
void onGameResize(Vector2 size) {
|
|
super.onGameResize(size);
|
|
|
|
this.size = size * 0.4;
|
|
}
|
|
}
|
|
|
|
class ResizeExampleGame extends FlameGame {
|
|
ResizeExampleGame() : super(children: [ResizingRectangle()]);
|
|
|
|
static const description = '''
|
|
This example shows how to react to the game being resized.
|
|
|
|
The rectangle will always be 40% of the screen size.
|
|
|
|
Try resizing the window and see the rectangle change its size.
|
|
''';
|
|
}
|