Change CocoonJS canvas' background color

Get help using Construct 2

Post » Fri Mar 22, 2013 6:47 am

Hi guys,

is there any way to change the CocoonJS canvas' background color with construct 2? My game is supposed to support multiple mobile form factors and on some the layout does not fill the entire screen. The default background color of the canvas appears to be white, which results in having a white horizontal border on the bottom of the screen when running my game on my Android tablet for example. Is there a way to control that background color's attribute from Construct 2 or is there a file I can edit after export?

Regards, Chris
B
6
Posts: 33
Reputation: 816

Post » Fri Mar 22, 2013 3:50 pm

Okay, what I've found so far after a google research is some code from the page http://doc.ludei.com/CocoonJS_App_ForCocoonJS/symbols/src/cocoonjsextensions_CocoonJS_App_ForCocoonJS.js.html that contains the following:


6     /**
7     * This namespace represents all the basic functionalities available in the CocoonJS extension API.
8     * @namespace
9     */
10     CocoonJS.App = CocoonJS.App ? CocoonJS.App : {};
11
12     if (!CocoonJS.App.nativeExtensionObjectAvailable)
13     {
14        (function createWebView() {
15             [...]
22             CocoonJS.App.EmulatedWebView.style.backgroundColor = 'transparent';
23             [...]
33        })();
34     }

However, how and where do I have to include that into my c2runtime.js? Any ideas?TheStoepsel20012013-03-22 15:52:21
B
6
Posts: 33
Reputation: 816

Post » Mon Jul 13, 2015 8:47 am

Same trouble here...
B
6
Posts: 5
Reputation: 260


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Marxally, Naightwolf, pierre244 and 18 guests