Javascript 相位器3调整大小后图像质量低
移相器3版本。3.20.1当我调整图像大小时,我无法找到不丢失质量的方法。 我尝试了不同的变体:在图像上设置DisplaySize或setScale,在相机上设置Zoom,但图像看起来仍然是像素化的 在游戏配置中,我将类型更改为WebGl/Canvas,设置为渲染对象参数:antialias、pixelArt、roundPixels 我的游戏配置:Javascript 相位器3调整大小后图像质量低,javascript,phaser-framework,Javascript,Phaser Framework,移相器3版本。3.20.1当我调整图像大小时,我无法找到不丢失质量的方法。 我尝试了不同的变体:在图像上设置DisplaySize或setScale,在相机上设置Zoom,但图像看起来仍然是像素化的 在游戏配置中,我将类型更改为WebGl/Canvas,设置为渲染对象参数:antialias、pixelArt、roundPixels 我的游戏配置: { type: Phaser.AUTO, disableContextMenu: true, banner: false,
{
type: Phaser.AUTO,
disableContextMenu: true,
banner: false,
scale: {
height,
width,
parent: 'canvas',
mode: Phaser.Scale.NONE,
autoRound: true,
},
render: {
roundPixels: true,
},
}
在html中调整图像大小
按设置比例调整图像大小
设置相机变焦
谢谢:可能不是最好的解决方案,因为这意味着要回到3.15版本 在此版本中,您可以在配置中更改分辨率,如下所示:
var config = {
...
resolution: 3, // the higher the better (but certainly slower)
...
}
可能不是最好的解决方案,因为这意味着要回到3.15版本 在此版本中,您可以在配置中更改分辨率,如下所示:
var config = {
...
resolution: 3, // the higher the better (but certainly slower)
...
}
我找到了另一个解决方案,对于mobile,我调整画布大小,而不是更改相机缩放:
this.scene.scale.parent.width = Math.round(width);
this.scene.scale.parent.height = Math.round(height);
this.scene.scale.canvas.style.width = Math.round(width) + 'px';
this.scene.scale.canvas.style.height = Math.round(height) + 'px';
game.canvas.style.width = width + 'px';
game.canvas.style.height = height + 'px';
我花了将近一周的时间研究这个解决方案,我希望有人能帮助我我找到了另一个解决方案,对于mobile,我调整画布的大小,而不是改变相机的缩放:
this.scene.scale.parent.width = Math.round(width);
this.scene.scale.parent.height = Math.round(height);
this.scene.scale.canvas.style.width = Math.round(width) + 'px';
this.scene.scale.canvas.style.height = Math.round(height) + 'px';
game.canvas.style.width = width + 'px';
game.canvas.style.height = height + 'px';
我花了将近一周的时间来解决这个问题,希望有人能帮我