Search the Community
Showing results for tags 'data uri'.
-
This isn't to ask for help, but more of a suggestion for a fix in future Phaser versions, and maybe also a help to other Phaser Developers. In my game I save a screenshot of the canvas and save it to the users local JSON sessionstorage to call upon later. Now with that Image data URI saved I wanted to paste the image onto the screen, bearing in mind you need to cache the image first: create: function () { /* Caching START */ this.gameScreenshot01 = gameData.playerSettings[0].savedGames[0].screenshot; this.gameScreenshot01Image = new Image(); this.gameScreenshot01Image.src = this.gameScreenshot01; this.game.cache.addImage('image01', null, this.gameScreenshot01Image); /* Caching END */ /* Now actually paste the image to the canvas START */ this.gameScreenShotInput = this.game.add.sprite(100, 100, 'image01'); /* Now actually paste the image to the canvas END */ }, Now this works great for desktop, but not mobile. A fix for it I have found is that mobiles seem to have a problem caching it the first time. The fix? Cache it twice! BUT you have to do it among 2 different functions throughout the project and then paste the image to the canvas. Hope that's helps anyone out there. My mobile is on IOS9, so maybe there were a few bugs out there at the beginning of this release. Thanks