Jump to content

BitmapData update call doesn't work


nmindiedev
 Share

Recommended Posts

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: function

this.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);
Link to comment
Share on other sites

  • 1 year later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...