nmindiedev Posted September 18, 2015 Share Posted September 18, 2015 Hi everyone! Phaser version: 2.4.3. My intention was to render the cellular automata generated map on the screen.To do this I created a BitmapData object and used a basic set of setPixel(...) loops. Everything works but it took 8 seconds when the 'immediate' flag is true. And when the 'immediate' flag is false the map image just won't be visible at all while the console.log(...) says everything is finished so there's no freezing. Thus, the problem is in bmd.update(...) in the end that has no effect at all. Tried filling the entire bitmap with the white color before the loops: the entire bitmap is white but there's no trace of setPixel calls. create: functionthis.bmd = this.game.make.bitmapData(automata.width, automata.height);for (var i = 0; i < automata.width; i++) { for (var j = 0; j < automata.height; j++) { if (automata.cellmap[i][j]) this.bmd.setPixel(i, j, 255, 255, 255, false); }}this.bmd.update(0, 0, automata.width, automata.height);var img = this.bmd.addToWorld();img.smoothed = false;img.scale.set(2); kodemizer 1 Link to comment Share on other sites More sharing options...
kodemizer Posted May 21, 2017 Share Posted May 21, 2017 After setting pixels, I solved it like so: mybitmap.context.putImageData(mybitmap.imageData, 0, 0); mybitmap.dirty = true; Link to comment Share on other sites More sharing options...
Recommended Posts