feat!: Add CameraComponent to FlameGame (#2740)

This PR adds the `CameraComponent` and a `World` by default to the
FlameGame.
This commit is contained in:
Lukas Klingsbo
2023-09-18 21:06:37 +02:00
committed by GitHub
parent 5be6fc8cae
commit 7c2f400076
89 changed files with 1107 additions and 821 deletions

View File

@ -17,14 +17,9 @@ starts to drop in FPS, this is without any sprite batching and such.
final counterPrefix = 'Animations: ';
final Random random = Random();
final world = World();
late final CameraComponent cameraComponent;
@override
Future<void> onLoad() async {
cameraComponent = CameraComponent(world: world);
addAll([cameraComponent, world]);
await cameraComponent.viewport.addAll([
await camera.viewport.addAll([
FpsTextComponent(
position: size - Vector2(0, 50),
anchor: Anchor.bottomRight,