mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-10-30 16:36:57 +08:00 
			
		
		
		
	feat!: Add CameraComponent to FlameGame (#2740)
This PR adds the `CameraComponent` and a `World` by default to the FlameGame.
This commit is contained in:
		| @ -15,26 +15,18 @@ class ParticlesInteractiveExample extends FlameGame with PanDetector { | ||||
|   final random = Random(); | ||||
|   final Tween<double> noise = Tween(begin: -1, end: 1); | ||||
|   final ColorTween colorTween; | ||||
|   final double zoom; | ||||
|   final world = World(); | ||||
|   late final CameraComponent cameraComponent; | ||||
|  | ||||
|   ParticlesInteractiveExample({ | ||||
|     required Color from, | ||||
|     required Color to, | ||||
|     required this.zoom, | ||||
|   }) : colorTween = ColorTween(begin: from, end: to); | ||||
|  | ||||
|   @override | ||||
|   Future<void> onLoad() async { | ||||
|     cameraComponent = CameraComponent.withFixedResolution( | ||||
|       world: world, | ||||
|       width: 400, | ||||
|       height: 600, | ||||
|     ); | ||||
|     addAll([cameraComponent, world]); | ||||
|     cameraComponent.viewfinder.zoom = zoom; | ||||
|   } | ||||
|     required double zoom, | ||||
|   })  : colorTween = ColorTween(begin: from, end: to), | ||||
|         super( | ||||
|           camera: CameraComponent.withFixedResolution( | ||||
|             width: 400, | ||||
|             height: 600, | ||||
|           )..viewfinder.zoom = zoom, | ||||
|         ); | ||||
|  | ||||
|   @override | ||||
|   void onPanUpdate(DragUpdateInfo info) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Lukas Klingsbo
					Lukas Klingsbo