Skip to content

Resolution of BitmapMask gets somehow corrupted on game resize #6769

Closed
jonesrussell/nishman
#6
@pavels

Description

@pavels

Phaser 3.80.1

When you create small game, resize it to large and then create mask and set it on object, the object resolution gets lowered and the object becomes pixelated.

Here is reproduction code:

class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.image('ayu', 'assets/pics/ayu.png');
    }

    create ()
    {
        this.game.scale.resize(800, 600);

        const sprite = this.add.sprite(400, 300, 'ayu');

        const rt = this.make.renderTexture({x: 0, y: 0, width: 800, height: 600, add: false}).setOrigin(0.0);
        const mask = new Phaser.Display.Masks.BitmapMask(this, rt);

        rt.fill(0x000000, 1);

        this.input.on('pointerdown', pointer => {
            sprite.setMask(mask);
        })        
    }
}

const config = {
    type: Phaser.AUTO,
    width: 200,
    height: 150,
    backgroundColor: '#0a440a',
    parent: 'phaser-example',
    scene: Example
};

const game = new Phaser.Game(config);

Run the code, click on the scene and see the effect.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions