Author Topic: Straight Lines?  (Read 3107 times)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Straight Lines?
« on: September 03, 2012, 04:35:00 AM »
Probably a long shot, but it is possible to render straight lines using NGUI?

Basically I want to draw some lines between boxes, as if I was in Excel doing a diagram.
I am almost certain this is a no, but I just thought I would check anyway :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Straight Lines?
« Reply #1 on: September 03, 2012, 07:22:41 AM »
I do it on Windward by having a sliced sprite with a 1 pixel border on two of the 4 sides, and with "fill center" disabled.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Straight Lines?
« Reply #2 on: September 03, 2012, 08:14:32 AM »
Ok, so you mean (for example) a sprite with just a pixel in each corner and the rest blank?

And when I mean straight line, it has to go diagonally, not just a straight line only in x or y.

My idea was simply to just have a one pixel sprite, stretch it in one axis and then rotate it accordingly. Although I can imagine that killing the fill rate though.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Straight Lines?
« Reply #3 on: September 03, 2012, 09:54:29 AM »
No, imagine a sprite with a line going from top left to bottom left corner and another from top right to bottom right. That's what I use on Windward. It has no effect on fill rate if it's just 1 pixel and assuming you unchecked "fill center".

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Straight Lines?
« Reply #4 on: September 03, 2012, 10:41:34 PM »
Ok, I think I get it, I will have a test later.

I am going to will make a 4x4 sprite like this

O = White Pixel

X = Transparent Pixel

OXXO
OXXO
OXXO
OXXO

And then a sliced sprite with a 1 pixel border on two of the 4 sides (presumably the sides where there are pixels), and with "fill center" disabled.

Thanks :)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: Straight Lines?
« Reply #5 on: September 21, 2012, 06:00:35 AM »
Cheers for the advice Arenmook. I got it all working now :)