Sign in to follow this  
nmindiedev

BitmapData update call doesn't work

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);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.