Author Topic: NGUI 3.6.2 Stretch a sprite full screen  (Read 5614 times)

sonicviz

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 58
    • View Profile
NGUI 3.6.2 Stretch a sprite full screen
« on: June 06, 2014, 10:26:51 AM »
Hi,
I've watch the tutorials but still can't figure out how to replicate the simple case of stretching a sprite horizontally and vertically so it will be locked as a panel background no matter what screen size.

I understand how the new anchoring works but the new stretch is head scratching.

clues?

travisschau

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: NGUI 3.6.2 Stretch a sprite full screen
« Reply #1 on: June 06, 2014, 11:16:53 AM »
Set the Anchors to your sprite to unified, and set Left to Target's Left, Right to Target's Right, Bottom to Target's Bottom, and Top to Target's Top. Then set each number to 0.

That anchors it to all sides and stretches the image to match your view.

Should look like the screenshot attached.

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: NGUI 3.6.2 Stretch a sprite full screen
« Reply #2 on: June 06, 2014, 01:41:21 PM »
Just a question how can I stretch a sprite, but not anchor to the screen, for example I want a sprite to stretch 2/3 on both sides(horizontal and vertical) but move it freely (not anchor it).

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: NGUI 3.6.2 Stretch a sprite full screen
« Reply #3 on: June 06, 2014, 02:12:18 PM »
Darkmax, for that I'd use the old UIStretch as the new system doesn't really support that as it is. :(

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.6.2 Stretch a sprite full screen
« Reply #4 on: June 06, 2014, 09:50:20 PM »
Why not, Nicki? NGUIMath.MoveRect lets you move it around freely, even if it's anchored.

sonicviz

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 58
    • View Profile
Re: NGUI 3.6.2 Stretch a sprite full screen
« Reply #5 on: June 06, 2014, 10:11:44 PM »
TY!

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: NGUI 3.6.2 Stretch a sprite full screen
« Reply #6 on: June 10, 2014, 12:27:03 PM »
Aroo, I need to mess more with the new anchors I gather.