Author Topic: size of UILabels  (Read 6810 times)

wouter

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 39
    • View Profile
size of UILabels
« on: December 12, 2012, 01:36:58 PM »
I have an empty gameObject with elements attached and I want to know the size(specifically the height) of them combined.
UILabels have a specific width set, so they grow in Ysize when the text gets more.

I search and found NGUIMath.CalculateRelativeWidgetBounds, but this doesn't give me the right results.
Than I found UIFont.CalculatePrintedSize, but I dont know how to set it up... (how can I use that? example maybe?).

And I think I have to combine them in order to get the height of everything combined?


*small other question;

I want to load a Texture2D into a sprite through script, how can I go about doing that.
This will not be a texture that is in an atlas, but seperate images.

« Last Edit: December 12, 2012, 01:43:05 PM by wouter »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: size of UILabels
« Reply #1 on: December 12, 2012, 03:09:47 PM »
Why is it not giving you the right results? CalculatePrintedSize is for text. CalculateRelativeWidgetBounds is all you need. Specify the panel as the root for that function.

Use UITexture to display non-atlased images.

wouter

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 39
    • View Profile
Re: size of UILabels
« Reply #2 on: December 12, 2012, 05:49:30 PM »
Why is it not giving you the right results? CalculatePrintedSize is for text. CalculateRelativeWidgetBounds is all you need. Specify the panel as the root for that function.

Use UITexture to display non-atlased images.

ah it appears I was making a mistake in my own calculations  :P, it works.

About the UITexture, It appears my clipping doesnt work on it.
I want to use it as image to zoom into, with clipping...
Is there a way around this?


******edit: nevermind, I shouldn't post before really trying myself  :)****

Ok one more question then:

I changed the shader in order to get the clipping on the UITexture.
However, I assign textures to it from another scipt, with texture2D.
I can see the textures switching correctly in the UITexture, but somehow the image wont update during a play test..?
« Last Edit: December 12, 2012, 06:00:39 PM by wouter »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: size of UILabels
« Reply #3 on: December 13, 2012, 03:40:13 AM »
That gets fixed in 2.2.7 :)

wouter

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 39
    • View Profile
Re: size of UILabels
« Reply #4 on: December 14, 2012, 12:50:45 PM »
That gets fixed in 2.2.7 :)

can I update this new version for free, or do I have to buy it again? :-\
and when will is it expected?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: size of UILabels
« Reply #5 on: December 14, 2012, 07:51:36 PM »
All updates are always free. Update is scheduled for the 22nd when I return from Copenhagen.

wouter

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 39
    • View Profile
Re: size of UILabels
« Reply #6 on: January 14, 2013, 04:05:24 PM »
All updates are always free. Update is scheduled for the 22nd when I return from Copenhagen.

Hi Aren,

is the new update already available.

Since I baught Ngui through your site with paypal, how can I update it?  ???

broknecho

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 33
    • View Profile
Re: size of UILabels
« Reply #7 on: January 14, 2013, 05:10:51 PM »
Hey wouter!

If you bought NGUI through the site, you should have an email with a "personal download link" in it that will always point to the most recent version of NGUI.

So search your email for "NGUI" or "personal download link" and you should find the link you first received.