TextureDrawCircle

Author: Eric Haines (Eric5h5)

Description
Draws single-pixel-wide, non-anti-aliased circles inside a texture. This isn't for drawing circles on the screen (unless the texture fills the entire screen, of course). Circle drawing code adapted from some example code in another web page somewhere on teh intarnets.



Usage
Have this script somewhere in your project. Call the function by the name of the script ("TextureDraw" in this case) plus ".Circle". The arguments are:

function Circle (texture : Texture2D, x : int, y : int, radius : int, color : Color)

"texture" is the texture you want to draw the circle in, "x" and "y" are the x and y coordinates of the midpoint of the circle, "radius" is the radius of the circle in pixels, "color" is the color of the circle. Circles drawn in the texture won't show up until Apply is called; for speed reasons, this should be done last if more than one circle is being drawn at once. A code example, which draws some random circles in a texture and results in something similar to the image above:

What happens to points drawn outside the texture boundaries depends on whether the texture is set to clamp or repeat: clamp means the circle won't draw past the edges, and repeat makes the circle start over from the other side (this behavior is inherent to SetPixel).