phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Dynamic Texture fill fails in Canvas mode

Open samme opened this issue 2 years ago • 1 comments

Version

  • Phaser Version: 3.70.0

Description

Create a game with the Canvas renderer.

Create a Dynamic Texture, fill with a color, and add an Image with the texture.

No fill appears.

Example Test Code

class Example extends Phaser.Scene {
    create() {
        this.textures.addDynamicTexture('area1', 128, 128).fill(0x00ff00);

        this.add.image(100, 100, 'area1').setOrigin(0);
    }
}

const config = {
    type: Phaser.CANVAS,
    scene: Example
};

new Phaser.Game(config);

No green appears. Compare with Phaser.WEBGL.

Additional Information

The texture has width and height -1 and these are used in

https://github.com/photonstorm/phaser/blob/47d393ac2900da02dfe35fc673050cefcb9a0d82/src/textures/DynamicTexture.js#L427

samme avatar Dec 01 '23 20:12 samme

Perhaps in the canvas render, the default value maybe not being set.

gammafp avatar Dec 22 '23 14:12 gammafp

Thank you for submitting this issue. We have fixed this and the fix 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 Jan 31 '24 17:01 photonstorm