Dear all,
Our game resizes perfectly on desktop and mobile. The problem is that on devices with higher DPR the images look pixelated.
Here is the current setup:
const width = window.innerWidth;
const height = window.innerHeight;
const config: GameConfig = {
type: Phaser.CANVAS,
scale: {
fullscreenTarget: 'app-root',
parent: 'the-canvas',
mode: Phaser.Scale.RESIZE,
width: width,
height: height,
}
};
On each resize we call:
gameResize(){
// Long and tedious calculations omitted
this.scene.cameras.main.setSize(gameSize.width, gameSize.height);
this.scene.cameras.main.setZoom(cameraZoom * zoomScale);
}
Desired:
width = window.innerWidth*dpr;
height = window.innerHeight*dpr;
Attempts:
-
Changing the mode to FIT, the game fits and the resolution of the game is perfect (no pixelated sprites). The game does not resize when we change orientation.
a. Tried manually resizing the canvas to no avail.
b. Tried manually setting css properties witdh + height at 100%
c. Tried manually setting this.scene.scale.canvas.width and height. -
When the mode is RESIZE there is no change at tall. The game width and height remains small, even though I have set it to *dpr (dpr on my phone is 2) in the config.
a. Tried adding resolution to the game config, but this is not working currently (as read in the documentation)
b. Tried in oh so many ways to set the gameSize to be higher with no success…
If you have any suggestions, I would be very grateful.