Plugin developers PLEASE READ: new export testing

For developers using the Construct 2 Javascript SDK

Post » Thu May 10, 2012 3:05 pm

All plugin and behavior developers:

The new CocoonJS exporter and upcoming directCanvas exporter may need changes to third party plugins/behaviors. In theory, existing plugins should work without modification because the wrappers still run Javascript. However, in practice, some changes may be necessary because they are not based on a full browser - they just simulate one. There may be features missing or working slightly differently to real browsers. This could cause your plugin to break, or worse, prevent the entire project from running at all.

Simple plugins and behaviors which are logic-only (only make calls to C2's engine) should be fine. However, any plugins which use browser features, such as any DOM calls, use of Image() or Canvas() objects, or controls like listboxes or input fields, may not work or may need changing. Also note anything using jQuery will not work because jQuery is not included in these exporters. The official Button and Textbox plugins are disabled for these exporters because there is not currently an easy way to get them working.

Please test your plugins and behaviors work when exporting to CocoonJS and (when it comes) directCanvas. This is important to prevent users who use your addons finding their projects are broken in CocoonJS or directCanvas, and if the problem is caused by third party code we can't officially help them.

Thanks! If you have any questions please ask them in this forum and we'll do our best to help. We may also need to collaborate between ourselves and appMobi and Ludei to get features added that popular third party addons use so we can improve overall support for Construct 2.Ashley2012-05-10 15:08:09
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Thu May 10, 2012 11:20 pm

"Also note anything using jQuery will not work because jQuery is not included in these exporters."

Uh, how does engine solve this problem since jQuery is used in engine?
B
97
S
22
G
179
Posts: 4,126
Reputation: 104,559

Post » Fri May 11, 2012 11:18 am

The main engine has had all references to jQuery disabled when running in CocoonJS or directCanvas. It was a bit tricky, but on the whole it's only used for utilities, form controls, and controlling the canvas in the HTML page. They could all be worked around without jQuery in the wrappers (except form controls which are disabled and won't work at all). It's a pain, but necessary to get it working.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Fri May 11, 2012 11:48 am

@Ashley

Thank you, I will try to update them.
B
97
S
22
G
179
Posts: 4,126
Reputation: 104,559

Post » Fri May 11, 2012 12:48 pm

Hm, I use plenty of canvas stuff in SpriteFont plugin... I'll have to look into this a bit, figure out whether I need to rewrite the drawing functions.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun May 13, 2012 3:19 am

@Ashley Question about jQuery Call

Hi, I found that touch plugin had mouse listener created by jQuery calls.
For example,
[code]jQuery(document).mousemove(
    (function (self) {
        return function(info) {
            self.onMouseMove(info);
        };
      })(this)
);[/code]
How does jQuery Calls in these new exporter? Will these jQuery Calls be ignored or...?
B
97
S
22
G
179
Posts: 4,126
Reputation: 104,559

Post » Sun May 13, 2012 5:13 pm

@rexrainbow

If you look at the latest source, the Touch object will not use jQuery (nor add any mouse events) if this.runtime.isDomFree is set. "DOM free" isn't the best name really, but it's a flag which is true when running in one of the wrappers which is not a full browser (i.e. directCanvas or CocoonJS). Your own plugins can use this to skip calls to jQuery as well.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Mon May 14, 2012 12:26 am

@Ashley

Thanks, I got it.
B
97
S
22
G
179
Posts: 4,126
Reputation: 104,559

Post » Sun May 27, 2012 12:04 pm

@Ashley

Could these new exporters get external file (since ajax plugin still has jQuery call)?

rexrainbow2012-05-27 12:04:55
B
97
S
22
G
179
Posts: 4,126
Reputation: 104,559

Post » Tue Jun 19, 2012 6:28 am

It would be really useful to get access to files included in the project. Currently, the games only get a black screen when running in CocoonJS launcher (android) if including the Ajax object (even if not using it).
B
20
S
5
G
4
Posts: 51
Reputation: 4,139

Next

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests