I have started to develop a small game with Flutter and Flame. However, I have a problem: how can I define a maximum resolution for my game for users who might be on a browser on a PC (since my game is a platformer) so that the experience will be the same no matter how large the screen is?
From reading your comment to the other answer I think I know what you are looking for, and that is the FixedSizeViewport
if you are using the CameraComponent
(which I suggest that you do), if you are using the legacy camera it is called FixedResolutionViewport
.
When creating the CameraComponent
you can use the specific constructor for this to have it set up this viewport for you (or you can set the viewport manually afterwards):
final cameraComponent = CameraComponent.withFixedResolution(
width: 800,
height: 600,
world: world,
);