Euflorium: The Eufloria Community

Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: annikk.exe on June 01, 2011, 11:08:51 PM

Title: DrawBox()
Post by: annikk.exe 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 ?
Title: Re: DrawBox()
Post by: Aino 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!
Title: Re: DrawBox()
Post by: annikk.exe 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?
Title: Re: DrawBox()
Post by: Aino on June 02, 2011, 12:10:59 AM
Cordinates of each corner...
Title: Re: DrawBox()
Post by: annikk.exe 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.
Title: Re: DrawBox()
Post by: Aino 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)
Title: Re: DrawBox()
Post by: Pilchard123 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
Title: Re: DrawBox()
Post by: Aino 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 :)
Title: Re: DrawBox()
Post by: annikk.exe on June 02, 2011, 12:44:42 AM
Yes I see what you mean now.  Hmm, either interpretation can be correct, I suppose.  :>
Title: Re: DrawBox()
Post by: Pilchard123 on June 02, 2011, 02:56:47 AM
A DrawPoly() would be useful here... arguments are the co-ords of the points.
Title: Re: DrawBox()
Post by: Aino on June 09, 2011, 10:58:28 PM
How do you use DrawPoly()? What are the arguments?
Title: Re: DrawBox()
Post by: annikk.exe 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..
Title: Re: DrawBox()
Post by: Pilchard123 on June 09, 2011, 11:39:55 PM
Hold on, I've nearly finished making it.
Title: Re: DrawBox()
Post by: annikk.exe on June 10, 2011, 12:15:23 AM
Hah

Nice :>

Can it be n-sided? :>
Title: Re: DrawBox()
Post by: Pilchard123 on June 10, 2011, 12:19:41 AM
Yup.

http://www.dyson-game.com/smf/index.php?topic=1359.0