More support for UI controls, layout manager
BasiliosZ

It would be nice to have more support for UI controls - unless it's already in and I missed it!

I also wonder how easy it could be, once UI controls are in, to implement some simple form of layout management for UI controls, to avoid having to place them manually using absolute coordinates - always a no-no when resolution can change.

1 Comment
Gio

What features would you like to see exactly?

At the moment, resolution can change, but can also be fixed - or can be fixed within some predetermined limits.

Using the setAlignment function of scene objects,  you can specify where your UI appears relative to any edge of the screen. So for example:
 

obj.setPosition(-wade.getScreenWidth() / 2 + 100, -wade.getScreenHeight() / 2 + 50);

This places the object 100 pixels from the left edge of the screen, and 50 pixels from the top edge. However, this:

 

obj.setAlignment('left', 'top);

ensures that the distance from the left and top edges of the screen remains constant even when the resolution changes.


In addition to this, you can use wade.setMinScreenSize() and wade.setMaxScreenSize() to set some limits for your resolution. If you set the minimum and maximum limits to the same value, then the resolution never changes.


This means that if the window is resized, the canvas objects are stretched to fill the screen (always keeping a constant aspect ratio), but the number of pixels in the canvas is fixed.


You can also control this stretching behavior using wade.setWindowMode();

Post a reply
Add Attachment
Submit Reply
Login to Reply