ID:111489
 
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
DrawTriangle(rgb,x1,y1,x2,y2,x3,y3)
This procedure would draw a filled triangle based on the coordinates given.

DrawCircle(rgb,x,y,r)
This procedure would draw a filled circle at x and y with r being the radius.
Wouldn't you want these to be pixel specific?
Yes. I should have mentioned that.
I'd very much like to bump this. So, here I am!

These would be pretty great features; especially with the BYOND v500's focus on animation, client-side icon stuff, and whatnot. Generally making things easier. Drawing Triangles and Circle in DM is still kind of difficult, though. So, it'd be great to have that natively.
With Triangles you can build any other shape quite easy, too. Circles are just generally great to have.

So basically, we'd then have:

icon.DrawCircle
icon.DrawTriangle
icon.DrawBox (which should really be called DrawRect, imo)
In response to Super Saiyan X (#3)
A square is a rectangle, but a rectangle is not a square.

I'd be fine with having to draw circles myself if circular collision was native.
In response to Albro1 (#4)
Albro1 wrote:
A square is a rectangle, but a rectangle is not a square.

and a box is three dimensional, and doesn't need to have sharp corners.


but, ok, yes. DrawRect then.
Using the new transform functions, can't you just have an icon full of basic shapes (a circle, a rectangle, and triangles of various types (like isosceles, right, equilateral, etc.)) all in white, then just color them and stretch them before display?

Not that a native, single-function option wouldn't be more convenient...
In response to SuperSaiyanGokuX (#6)
A big problem with this right now is how antialiasing messess with the pixel quality.



You can use matrix manipulation to get most shapes you want, but the antialiasing will give your shapes unsightly seams. I still support native shape drawing, though.
I really think native shape drawing could be fixed by simply having a nearest-neighbor blending mode for some sprites.

The image above was from one of my experiments with attempting to do a first-person projection with the new matrix transform features. It's two triangles projected to be a single quad.

Unfortunately, you see the seams.
In response to Ter13 (#8)
My rotating screen didn't have any seams, thanks to the anti-aliasing. Before 500, seams were all over the place because the rotated icons didn't always fit together. It's too bad it isn't perfect, seeing those transformed triangles. Transformed appearance's dependence on graphics hardware may even make it inconsistent on different machines; I might not see seams if I were to try that out.
Post your specs?

Here's the first attempt at it:

http://www.byond.com/developer/Ter13/Trapezoidtest

Maybe I'm doing this wrong.

My specs are:

2xNvidia GTX 660 in SLI
8GB DDR3 (1600, I think)
Core i7 920 OC'd to 3.2 GHZ
Windows 7 x64 Ultimate
I think it would be good to have a /shape datum which sort of works like an icon for use of drawing shapes on screen. The map control isn't so much a drawing canvas as it is an entity holder.

Possibly:
shape
var
length
points[length][2] // pixel offsets
color
alpha
icon // "map" the shape to display only a section of the pixels
In response to Ter13 (#10)
Ter13 wrote:
Post your specs?
Here's the first attempt at it:
http://www.byond.com/developer/Ter13/Trapezoidtest
Maybe I'm doing this wrong.
My specs are:
2xNvidia GTX 660 in SLI
8GB DDR3 (1600, I think)
Core i7 920 OC'd to 3.2 GHZ
Windows 7 x64 Ultimate

I notice in your test that the triangles have an overlap (if you were to paste on onto the other, one triangle extends a row or two of pixels onto the other). I edited the icon to remove those overlapping pixels, and while the seam is still visible, it was much less apparent...
In response to SuperSaiyanGokuX (#12)
Making the main diagonal line slightly transparent helps make it even less noticeable, but it's far from perfect. Now instead of a black seam, it's mixing in some white from the background object.


Black pixels are being added into the anti-aliased part. I think this may have been caused by the fix to remove different colored pixels behind the anti-aliasing. Otherwise, the triangles overlapping would have actually covered up the seam, rather than push it over a bit.
Hell, how about DrawLine()?