Oversight in Node-Webkit exporter

0 favourites
  • 3 posts
  • Ashley, i was wondering about why transparent backgrounds / "alpha canvas" is disabled in nodewebkit, specifically around line 329 in preview.js right before the renderer is created. I understand that alpha "doesn't work in nodewebkit", but my plugin, and perhaps others in the future, need to modify the z-index of the construct canvas to use it as a 2D overlay. I enabled alpha canvas for nodewebkit by disabling the flag, and truly nothing changes except the fact i can then use the construct 2 canvas as an overlay within node-webkit. It's an anti-feature to the node-webkit exporter to disable it this way, and right now the only way around it is for me to tell users they have to disable it for a particular basic option of my plugin to work in tandem with construct 2 in node-webkit.

  • Turning off alpha is a performance optimisation, which apparently can make a difference to fillrate-limited devices. It means the backing canvas doesn't have an alpha channel so the alpha components don't need to be filled or processed or composited to the screen. On platforms where there is typically nothing that can appear behind the canvas then the runtime sets this mode to allow the browser to optimise it if possible. This isn't limited to node-webkit - it's also used on Windows Store, Crosswalk and PhoneGap apps for the same reason.

    I guess your plugin needs to force alpha enabled on all platforms, but I don't want to just turn it off completely since that could de-optimise it even when unnecessary. So for the next build (in r188) I added a flag in the runtime you can use to force alpha mode enabled: set runtime.forceCanvasAlpha to true. You have to set that in the plugin or type constructor, since by the time you get to an instance's constructor/onCreate it's already read the value to initialise the renderer.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Awesome thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)