Hello Guest

Author Topic: Sliced sprite  (Read 10006 times)

Phantom

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Sliced sprite
« on: October 25, 2012, 08:28:10 am »
Hi.
I am using version 1.80 2D toolkit.

Using sliced sprite I will draw resizable pupup window with text, sprite. How set corret dimestion property in pixel if td2dTextMesh and td2dBaseSprite not have pixel size property/variable (May be I don't find it).

Thank you.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sliced sprite
« Reply #1 on: October 25, 2012, 09:36:16 am »
If the sprite collection is set up correctly, the dimensions of the textmesh and sprite are already pixel perfect by default. The sliced sprite only needs a dimension as it can be changed.

Phantom

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Sliced sprite
« Reply #2 on: October 25, 2012, 10:54:09 am »
May be I don't undestend you. But my pop before showing dynamicaly must be resized because must be dyslplay differenet text and sprites.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sliced sprite
« Reply #3 on: October 25, 2012, 12:44:29 pm »
The sprites intentionally don't have dimensions as they will always try to draw at pixel perfect. If your sprite is 32x128 pixels in size, it will try to dipsplay it at that resolution. If you then scale that up or down, it will make it bigger or smaller relative to that. What is it exactly you are trying to do? Some pics will really help understand.

Phantom

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Sliced sprite
« Reply #4 on: October 26, 2012, 10:04:23 am »
I add example what I will create. For scale using pixel I need know pixel size for text and sprite.
Ok sprite have pixel size but I don't know how calculate this value for text.

PS: On image values symbols, groups and lines can have different values.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sliced sprite
« Reply #5 on: October 26, 2012, 10:48:05 am »
You can use the renderer bounds on the sprite / textmesh to align things like that - that will be the easiest way to deal with this.

Phantom

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Sliced sprite
« Reply #6 on: October 26, 2012, 11:21:43 am »
Sorry. My noob questions.

Can you give me example code using renderer bounds.

I undestend property Bounds but not undestend how it convert to dimesions size for scale sliced sprite.
« Last Edit: October 26, 2012, 11:23:36 am by Phantom »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sliced sprite
« Reply #7 on: October 26, 2012, 11:31:12 am »
You can get renderer bounds for the sliced sprite too. Then everything will be in the same units

DarkSlash

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Sliced sprite
« Reply #8 on: August 12, 2015, 07:14:12 pm »
Can this be done only with 2DToolkit?