mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-11-01 01:18:38 +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:
		| @ -17,20 +17,21 @@ class RotateEffectExample extends FlameGame { | ||||
|     add small amounts of wobble, creating quasi-chaotic movement. | ||||
|   '''; | ||||
|  | ||||
|   final world = World(); | ||||
|   late final CameraComponent cameraComponent; | ||||
|   RotateEffectExample() | ||||
|       : super( | ||||
|           camera: CameraComponent.withFixedResolution( | ||||
|             width: 400, | ||||
|             height: 600, | ||||
|           )..viewfinder.anchor = Anchor.topLeft, | ||||
|           world: _RotateEffectWorld(), | ||||
|         ); | ||||
| } | ||||
|  | ||||
| class _RotateEffectWorld extends World { | ||||
|   @override | ||||
|   void onLoad() { | ||||
|     cameraComponent = CameraComponent.withFixedResolution( | ||||
|       world: world, | ||||
|       width: 400, | ||||
|       height: 600, | ||||
|     ); | ||||
|     addAll([cameraComponent, world]); | ||||
|  | ||||
|     final compass = Compass(size: 200); | ||||
|     world.add(compass); | ||||
|     add(compass); | ||||
|  | ||||
|     compass.rim.add( | ||||
|       RotateEffect.by( | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Lukas Klingsbo
					Lukas Klingsbo