Plugin developers PLEASE READ: new export testing

Forum Home Forum Home > Construct 2 Development > Javascript SDK development
 Post Reply Post Reply Page  12>
Author

Scirra Developer
78,592 Rep
Post Options Post Options   Quote Ashley Quote  Post ReplyReply Direct Link To This Post Topic: Plugin developers PLEASE READ: new export testing
    Posted: 10 May 2012 at 3:05pm
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.

Edited by Ashley - 10 May 2012 at 3:08pm
Back to Top
10,425 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2012 at 11:20pm
"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?
Back to Top

Scirra Developer
78,592 Rep
Post Options Post Options   Quote Ashley Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2012 at 11:18am
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.
Back to Top
10,425 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2012 at 11:48am
@Ashley

Thank you, I will try to update them.
Back to Top
10,193 Rep
Post Options Post Options   Quote Mipey Quote  Post ReplyReply Direct Link To This Post Posted: 11 May 2012 at 12:48pm
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.
Back to Top
10,425 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 13 May 2012 at 3:19am
@Ashley Question about jQuery Call

Hi, I found that touch plugin had mouse listener created by jQuery calls.
For example,
jQuery(document).mousemove(
    (function (self) {
        return function(info) {
            self.onMouseMove(info);
        };
      })(this)
);

How does jQuery Calls in these new exporter? Will these jQuery Calls be ignored or...?
Back to Top

Scirra Developer
78,592 Rep
Post Options Post Options   Quote Ashley Quote  Post ReplyReply Direct Link To This Post Posted: 13 May 2012 at 5:13pm
@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.
Back to Top
10,425 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2012 at 12:26am
@Ashley

Thanks, I got it.
Back to Top
10,425 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 27 May 2012 at 12:04pm
@Ashley

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



Edited by rexrainbow - 27 May 2012 at 12:04pm
Back to Top
2,213 Rep
Post Options Post Options   Quote basti Quote  Post ReplyReply Direct Link To This Post Posted: 19 Jun 2012 at 6:28am
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).
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down