how to bind to the canvas
starOfEden

There are not a lot of tutorials, any ways I went through some of them and didnt get how to bind to the canvas this is importand if I have a few canvases each with a diffrent App, in a case of HTML5 web App.

 

Thanks,

Ben

All 4 Comments
Gio

Hi Ben

 

WADE manages the creation and display of canvas objects - often a single application is made of multiple canvases on top of each other (one per layer), and depending on the platform, there may be more hidden canvases that WADE uses to double buffer the rendering, to improve performance or avoid some platform-specific bugs (for example in the native Android browser). So it isn't really possible to bind an application to a single canvas as such.

 

Also, by default, WADE resizes its canvas(es) to use as much of the screen as possible, compatibly with the aspect ratio restrictions that you may set. You can control this behavior by changing the "window mode" (with wade.setWindowMode) - for example setting it to 'container' will tell WADE that it has to fit the canvases inside a container div, called wade_main_div. This works largely on the assumption that there is a single App on the page.

 

If you want to have multiple Apps on the same page at the same time, the best way would be using iframes and putting each App in its own iframe. But I would suggest having a single App (so a single big container), and internally split it into several logical units, making it do different things on the different areas of the screen.

 

I hope this helps, but if you want to describe what you are trying to achieve I may be able to suggest a different approach.

Elliot

Gio, could you add the option to use another (user-selected) div instead of wade_main_div as the container though?

 

This way I think you could have more instances of wade on the same page without iframes?

starOfEden

Thanks,

 

also it seems the way you suggest to work in the tutorial, didnt work for me , i needed to put it under a web server for the main app to load...it seems it doesnt load from a browser..see another post on the subject.. 

 

Thanks,

Ben

Gio

@starOfEden: yes, I replied in the other thread :)

 

@Elliot: I don't see why not. That's a good suggestion, I'll do that for WADE 1.2. It won't work "out of the box", in the sense that WADE was written with the assumption that there would only be one active engine and App at any one time (so one active scene, one set of active input handlers, and so on). However, you could create different instances of WADE in different scopes, and that would work.

Post a reply
Add Attachment
Submit Reply
Login to Reply