8.5 – GUI Downscaling


As of version 1.3.0 we made gui downscaling available. It isn’t a loseless method. It just down (or up but not recommended) scales the whole gui and may result a loose of pixel perfectness. The best usage area of GUI downscaling is mobile devices. For example iPhone3 and iPhone4. Just design your gui for iPhone4 and downscale with 0.5 to match the same sizes for iPhone3. We added a property with name “Screen Scale Rules” to iGUIRoot. Since it is a list of rules, first of all just increase its size. Then modify it to suit your needs.

For example i added 2 rules. One for “normal pixel density” devices like iPhone3 and another for “higher pixel density” devices like iPhone4 which has retina display. In the first rule with name “Normal”, i selected the device type “AllMobile”. This means the rule will be valid for iOS and android devices. Then selected the resolution condition of “Width” and set min-max values to 0-500. This means the rule will be valid for devices with screen width between 0 and 500. And lastly the Dpi Scale property stands for the target scale of the gui elements which will be assigned if the rule is valid.

When there aren’t any valid rules, then the gui scale will remain 1 and non of the elements will be scaled. So you can say why did you added the rule with name “Normal”? Since its dpi scale value is 1 it looks pointless, and it really is. But i added it to just to look formal.

You can also change dpi scale of a root with code. There are two ways. You can either call iGUIRoot.setAllRootDpiScale method statically and change dpiScale of all roots, or you can set dpi scale of a single root by setting it’s dpiScale property.

iGUIRoot.setAllRootDpiScale(0.5f);
iGUIRoot.setAllRootDpiScale(0.5f);



or

root1.dpiScale = 0.5f;
root1.dpiScale = 0.5f;