phaser icon indicating copy to clipboard operation
phaser copied to clipboard

`Phaser.Scale` for pixel-perfect games

Open musjj opened this issue 9 months ago • 3 comments

https://photonstorm.github.io/phaser3-docs/Phaser.Scale.ScaleModes.html

A scaling mode that scales the canvas up by integer scales (x2, x3, etc.) to fit the target area would be useful for pixel-perfect games. Of course, it should not scale the canvas down if the target area is smaller than the canvas

musjj avatar Sep 22 '23 07:09 musjj

This can be done with scale mode FIT (or similar) and scale.setSnap().

I can't remember if I've requested already, but I would like snap options in the scale config, e.g.,

new Phaser.Game({
  pixelArt: true,
  scale: {
    mode: Phaser.Scale.FIT,
    width: 320,
    height: 200,
    snap: { width: 320, height: 200 },
    min: { width: 320, height: 200 },
  }
});

samme avatar Sep 23 '23 17:09 samme

Thanks, that works for me!

musjj avatar Sep 23 '23 17:09 musjj

Ah but still, having it as a built-in option would be nice, so I'll keep this open.

musjj avatar Sep 23 '23 17:09 musjj

Thank you for submitting this feature request. We have implemented this and the feature has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

photonstorm avatar Feb 19 '24 16:02 photonstorm