Hi
I tried to dynamically set the width and height of the wade main div using jquery, but that doesn't seem to change the app size which always loads at 800 x 600.
WADE, by default, resizes automatically to fit the whole screen (you can change that with wade.setWindowMode).
However, the resizing happens after the app's init function has been executed - this is to give you chance to decide, in the init function, what you want to do with setWindowMode.
So if you look at the screen size in the init function, that's not the actual screen size - that's the original screen size, which is what you set for wade_main_div in index.html, before the resizing occurs.
If you really need to, you can change the width and height of wade_main_div to whatever you like, but you must change the actual width and height attributes of the div, not its style properties - changing the style properties will stretch the game canvas, but not change the number of logical pixels in it. Resizing via jQuery, I believe, changes the style properties only.
I noticed in the documentation that the init function can take additional object parameters, but it didn't detail what those could / should be.
" appData Optional, Default: {} An object containing initialization data for the app"
That's a very good point, I should and will update the docs. The idea is that appData is whatever you like, it's just an extra parameter that you can use to pass data to your game. You can then access it as wade.app.appData. This is particularly useful when your html file is generated dynamically (say with PHP for example). So it's a way for your server scripts to communicate with your game (for example to set up the details of a player in an online game).
Also, if a user can zoom say a clickable level menu, is there a way to get the clickable (canvas ?) size rather than the screen size. i.e. if you have a 200x200 sprite and the user clicks less than -50 you do something. Now if that sprite is zoomed out and is now say 100x100 how do you correct so that you do something when the user clicks less than -25 ? Do you correct for the z index, or is there a way to get the new 'clickable' size ?
WADE takes care of the complicated bit. Sprites can react to zoom in different ways (depending on the properties of the layer they're in) - it can get quite complicated. But even when the position and size of an object on the screen change, its world space properties don't. When a user clicks, you get the click position in screen space. You want to transform it into world space (using wade.screenPositionToWorld() ), and then do all your calculations in world space units, because those never change when the camera moves. SceneObject.getPosition(), getSize(), etc. all return world-space values.
So you would do something like this:
this.onClick = function(eventData){ var worldPosition = wade.screenPositionToWorld(layerId, eventData.screenPosition); if (worldPosition.x - object.getPosition().x > -50) { // do something }};