Mirv Posted October 2, 2016 Share Posted October 2, 2016 I've been playing around with BimapData, generating composite images on the fly because I'm too lazy to combine them in an image editor program I noticed that the sprite drawn from the image cache key appeared in chrome, but not firefox. I reproduced this on the Phaser Sandbox - Single Sprite Template in chrome and firefox by setting the create code to the following: function create() { var sprite = game.add.sprite(0, 0, 'phaser'); var testBmd = game.make.bitmapData(27, 40); testBmd.copy('phaser'); testBmd.generateTexture('phaserTexture'); game.add.sprite(60, 60, 'phaserTexture') } The second phaser sprite appeared in chrome but not firefox. Any input is appreciated, thanks! Link to comment Share on other sites More sharing options...
gongohogarth Posted December 11, 2016 Share Posted December 11, 2016 I've run into this too. Super annoying! Link to comment Share on other sites More sharing options...
samme Posted December 14, 2016 Share Posted December 14, 2016 I think I’ve seen this in Safari too. Is it possible image.src = this.canvas.toDataURL("image/png"); might not be “loaded” by the time Phaser tries to create a new texture from it? Link to comment Share on other sites More sharing options...
samme Posted December 15, 2016 Share Posted December 15, 2016 Link to comment Share on other sites More sharing options...
samme Posted December 16, 2016 Share Posted December 16, 2016 Here is a workaround: function preload() { var bmd = game.make.bitmapData(0, 0); // draw on bmd … this.load.image('bmdImage', bmd.canvas.toDataURL()); bmd.destroy(); } function create() { // If you need to make a spritesheet: this.cache.addSpriteSheet('bmdSpritesheet', null, this.cache.getImage('bmdImage'), frameWidth, frameHeight, frameMax, margin, spacing); this.add.sprite(0, 0, 'bmdImage'); this.add.sprite(0, 0, 'bmdSpritesheet'); } Link to comment Share on other sites More sharing options...
samme Posted April 9, 2017 Share Posted April 9, 2017 phaser-ce/issues/136 Link to comment Share on other sites More sharing options...
Recommended Posts