Author Topic: DrawBox()  (Read 11731 times)

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
DrawBox()
« on: June 01, 2011, 11: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: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: DrawBox()
« Reply #1 on: June 02, 2011, 12:05:45 AM »
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: 4
  • Posts: 1,809
Re: DrawBox()
« Reply #2 on: June 02, 2011, 12:09:14 AM »
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: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: DrawBox()
« Reply #3 on: June 02, 2011, 12:10:59 AM »
Cordinates of each corner...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: DrawBox()
« Reply #4 on: June 02, 2011, 12:15:13 AM »
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: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: DrawBox()
« Reply #5 on: June 02, 2011, 12:20:01 AM »
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: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: DrawBox()
« Reply #6 on: June 02, 2011, 12:36:55 AM »
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: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: DrawBox()
« Reply #7 on: June 02, 2011, 12:39:05 AM »
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: 4
  • Posts: 1,809
Re: DrawBox()
« Reply #8 on: June 02, 2011, 12:44:42 AM »
Yes I see what you mean now.  Hmm, either interpretation can be correct, I suppose.  :>

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: DrawBox()
« Reply #9 on: June 02, 2011, 02:56:47 AM »
A DrawPoly() would be useful here... arguments are the co-ords of the points.

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 4
  • -Receive: 30
  • Posts: 1,527
  • Eufloria: Yes
Re: DrawBox()
« Reply #10 on: June 09, 2011, 10:58:28 PM »
How do you use DrawPoly()? What are the arguments?

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: DrawBox()
« Reply #11 on: June 09, 2011, 11: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: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: DrawBox()
« Reply #12 on: June 09, 2011, 11:39:55 PM »
Hold on, I've nearly finished making it.

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 4
  • Posts: 1,809
Re: DrawBox()
« Reply #13 on: June 10, 2011, 12:15:23 AM »
Hah

Nice :>

Can it be n-sided? :>

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 24
  • Posts: 932
  • Eufloria: Yes
Re: DrawBox()
« Reply #14 on: June 10, 2011, 12:19:41 AM »