Author Topic: DrawBox()  (Read 1963 times)

0 Members and 1 Guest are viewing this topic.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
DrawBox()
« on: June 01, 2011, 03:08:51 PM »
Can anyone explain to me how DrawBox() is used?  What variables do I use with it, etc ?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 20
  • Posts: 1,483
  • They'll eat you next!
  • Eufloria: Yes
Re: DrawBox()
« Reply #1 on: June 01, 2011, 04:05:45 PM »
Simple: DrawBox(id,fade,x1,y1,x2,y2,r,b,g,a)

Id is the texture I belive, haven't tested...
Fade is... fade? It talks for itslef hopelyfully...
X1,Y1,X2,Y2 is the points from a side,top,another side, bottom. Use theese four points to draw the box.
r,b,g,a is Red, Blue, Green, Alpha
Alpha is how visible the box is overall, so zero is an invisible box and one is a totally visible one that blocks every other sights. Now ofcourse you can have 0.3 or 0.7 or any number between 0 and 1(this rule also comes to r,b,g!)

EDIT: Note that it's impossible to draw it in any angle, it's stay vertical/horizontal what so ever!

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: DrawBox()
« Reply #2 on: June 01, 2011, 04:09:14 PM »
I'm a bit confused about how the coordinates are used.

X1, Y1...  are these coordinates of one corner of the box, or are they the lengths of sides?

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 20
  • Posts: 1,483
  • They'll eat you next!
  • Eufloria: Yes
Re: DrawBox()
« Reply #3 on: June 01, 2011, 04:10:59 PM »
Cordinates of each corner...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: DrawBox()
« Reply #4 on: June 01, 2011, 04:15:13 PM »
Ah wait, I've figured it out now, after some brief experimentation.  :>


It's NOT the coordinates of the corners though!  The corner is a point, which has 2 coordinates; X, and Y.  So to record the box by its corners you would need 8 values instead of 4.

Instead, X1 refers to "how far to the left shall the left hand side of the box extend?"
X2 refers to "how far to the right shall the right hand side of the box extend?"

Y1 and Y2 are how far up and down the top and bottom of the square should extend.

Rather clever really.  :>  Although it does mean you sacrifice the ability to rotate the square.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 20
  • Posts: 1,483
  • They'll eat you next!
  • Eufloria: Yes
Re: DrawBox()
« Reply #5 on: June 01, 2011, 04:20:01 PM »
I've used DrawBox alot, and I can remember that X1 is the left side and Y1 is how far up and X2 is how far right and Y2 is how far down, so:

Think it as drwing a line, replace drawbox with drawline and you see it, you jsut need 4 values fot eh coordination :)
(the line becomes the diagonal of the square/box)

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: DrawBox()
« Reply #6 on: June 01, 2011, 04:36:55 PM »
It is kinda the co-ords of points -- the top-left and bottom-right ones. Think of the box as a rectangle that has the line (x1,y1)-->(x2,y2) of one of its diagonals

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 20
  • Posts: 1,483
  • They'll eat you next!
  • Eufloria: Yes
Re: DrawBox()
« Reply #7 on: June 01, 2011, 04:39:05 PM »
It's the same way as drawing a line from point a to b, just adding a triangle on both sides.

Imagine pythagoras, where you need to draw new lines to find the distance², well, there the lines become visibloe and are the boundaries for the fill :)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: DrawBox()
« Reply #8 on: June 01, 2011, 04:44:42 PM »
Yes I see what you mean now.  Hmm, either interpretation can be correct, I suppose.  :>

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: DrawBox()
« Reply #9 on: June 01, 2011, 06:56:47 PM »
A DrawPoly() would be useful here... arguments are the co-ords of the points.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 20
  • Posts: 1,483
  • They'll eat you next!
  • Eufloria: Yes
Re: DrawBox()
« Reply #10 on: June 09, 2011, 02:58:28 PM »
How do you use DrawPoly()? What are the arguments?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: DrawBox()
« Reply #11 on: June 09, 2011, 03:26:51 PM »
I think he's saying "DrawPoly() would be useful", as in, it would be nice if that command actually existed..

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: DrawBox()
« Reply #12 on: June 09, 2011, 03:39:55 PM »
Hold on, I've nearly finished making it.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: DrawBox()
« Reply #13 on: June 09, 2011, 04:15:23 PM »
Hah

Nice :>

Can it be n-sided? :>

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: DrawBox()
« Reply #14 on: June 09, 2011, 04:19:41 PM »