Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: kork on April 24, 2012, 02:39:08 AM
-
Hi,
in our game we have a background image that we want to use as a backdrop for the main menu. The native size is 1280x1024 (5:4). I'd like this image to fill the height of the screen, but keep its aspect ratio (with the camera's background color pillarboxing the image). I built the following UI Tree:
* UI Root
** Camera
*** Anchor (Center)
**** Panel
***** UISprite (Pixel Perfect)
I tried attaching a UIAnchor to the UISprite and ticking the "Stretch to fill" checkbox. This streched the image across the screen, but did not preserve the aspect ratio. So how would I achieve this in NGUI?
-
Stretch to Fill option is long gone. Update to the latest version of NGUI and use the UIStretch script. It has an option to stretch based on height only.
-
Oh right, you have the free version... Free version isn't supported, it comes as-is. :)
-
Hmm I see there are significant differences between the free version and the full version. So i guess using the free version for evaluation purposes is probably not a good idea.
-
Free version was released over 2 months ago. I've kept updating NGUI since then -- quite a lot actually. All the changes are backwards compatible -- ie: UIs you make in the free version will still work in the latest version... but I obviously can't do the opposite and support an old version that has had many, many improvements and bug fixes.
-
Yap, perfectly understandable. Thanks for the quick replies. I just buy the full version now, and see how far it gets me :)
-
Got it working with the full version. Just for the sake of completeness, I've attached a screenshot on how to do it, in case someone else stumbles upon it. The important part is to put the aspect ratio into the "relative size" fields, otherwise the thing will get stretched.
-
Yup :)
-
Great work btw. Doing this was a nightmare with iGUI/EZGui and just a few clicks with NGUI :) I already like it.