Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Marvin_B_
Beginner
79 Views

Bitmap not working

Jump to solution

Hi everyone,

I have been using the Intel XDK for quite some while now and I am greatly enjoying developing apps with it, together with the Phaser framework.

Unfortunately, I am running into a little problem with using Bitmaps. It works perfectly on desktop, but when I deploy the app, the Bitmap images just do not show up. I am using Bitmap to create simple lighting effects for my game. The code is below, although I think the issue is coming from somewhere else.

    // bitmap darkness texture
    this.game.shadowTexture = this.game.add.bitmapData(3500, 2500);

    // updateLighting(this.game);
    this.game.shadowTexture.ctx.rect(0, 0, 3500, 2500);
    this.game.shadowTexture.ctx.fillStyle = '#646464';
    this.game.shadowTexture.ctx.fill();

    var r = 100 + this.game.rnd.integerInRange(1, parseInt(100/5));
    var gradient = this.game.shadowTexture.ctx.createRadialGradient(
        1750, 1750, 100 * 0.75,
        1750, 1750, r);
    gradient.addColorStop(0, 'rgba(255, 255, 0, 1.0)');
    gradient.addColorStop(1, 'rgba(255, 255, 0, 0.0)');

    this.game.shadowTexture.ctx.beginPath();
    this.game.shadowTexture.ctx.fillStyle = gradient;
    this.game.shadowTexture.ctx.arc(1750, 1750, r, 0, Math.PI*2, false);
    this.game.shadowTexture.ctx.fill();

    this.game.shadowTexture.dirty = true;

    // Create an object that will use the bitmap as a texture
    this.lightSprite = this.game.add.sprite(0, 0, this.game.shadowTexture);

    // darkens the colors of everything below this sprite
    this.lightSprite.blendMode = Phaser.blendModes.MULTIPLY;

 

Hope somebody has an idea how this could be resolved. 

Best regards

Tags (2)
0 Kudos
1 Solution
PaulF_IntelCorp
Employee
79 Views

There can be significant differences between the rendering features on the desktop versus the webview in which your app runs on a device. See this blog for some background. I recommend you build with Crosswalk to get an up-to-date and modern webview for your Android builds. Also, there are differences in the formats of image files that can be used, as a function of the device platform (Android vs. iOS and specific versions of the platforms).

View solution in original post

2 Replies
PaulF_IntelCorp
Employee
80 Views

There can be significant differences between the rendering features on the desktop versus the webview in which your app runs on a device. See this blog for some background. I recommend you build with Crosswalk to get an up-to-date and modern webview for your Android builds. Also, there are differences in the formats of image files that can be used, as a function of the device platform (Android vs. iOS and specific versions of the platforms).

View solution in original post

Marvin_B_
Beginner
79 Views

Hi Paul,

I recognized that the problem had something to do with the blendMode I was using. Removing that line and replacing it with setting the image's alpha value to 0.x, gave me the same result, except that using this way less computations have to be performed.

Thank you for the support. I am really pleased with the Intel XDK and with the support that is given on this forum.

Reply