Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(flame): Export FixedResolutionViewport and make withFixedResolution a redirect constructor #2817

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/flame/lib/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export 'src/camera/viewport.dart' show Viewport;
export 'src/camera/viewports/circular_viewport.dart' show CircularViewport;
export 'src/camera/viewports/fixed_aspect_ratio_viewport.dart'
show FixedAspectRatioViewport;
export 'src/camera/viewports/fixed_resolution_viewport.dart'
show FixedResolutionViewport;
export 'src/camera/viewports/fixed_size_viewport.dart' show FixedSizeViewport;
export 'src/camera/viewports/max_viewport.dart' show MaxViewport;
export 'src/camera/world.dart' show World;
20 changes: 9 additions & 11 deletions packages/flame/lib/src/camera/camera_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,20 @@ class CameraComponent extends Component {
/// [height] pixels are visible within the viewport. The viewfinder will be
/// initially set up to show world coordinates (0, 0) at the center of the
/// viewport.
factory CameraComponent.withFixedResolution({
CameraComponent.withFixedResolution({
required double width,
required double height,
Viewfinder? viewfinder,
World? world,
Viewfinder? viewfinder,
Component? backdrop,
List<Component>? hudComponents,
}) {
return CameraComponent(
world: world,
viewport: FixedResolutionViewport(resolution: Vector2(width, height))
..addAll(hudComponents ?? []),
viewfinder: viewfinder ?? Viewfinder(),
backdrop: backdrop,
);
}
}) : this(
world: world,
viewport: FixedResolutionViewport(resolution: Vector2(width, height)),
viewfinder: viewfinder ?? Viewfinder(),
backdrop: backdrop,
hudComponents: hudComponents,
);

/// The [viewport] is the "window" through which the game world is observed.
///
Expand Down