"texture" is the texture you want to draw the line in, "x1" and "y1" are the x and y coordinates of the starting point of the line, "x2" and "y2" are the x and y coordinates of the ending point of the line, "color" is the color of the line. Lines drawn in the texture won't show up until Apply() is called; for speed reasons, this should be done last if more than one line is being drawn at once. A code example, which draws some random lines in a texture and results in something similar to the image above:

"texture" is the texture you want to draw the line in, "x1" and "y1" are the x and y coordinates of the starting point of the line, "x2" and "y2" are the x and y coordinates of the ending point of the line, "color" is the color of the line. Lines drawn in the texture won't show up until Apply() is called; for speed reasons, this should be done last if more than one line is being drawn at once. A code example, which draws some random lines in a texture and results in something similar to the image above:

Revision as of 20:48, 10 January 2012

Author: Eric Haines (Eric5h5)

Description

Draws single-pixel-wide, non-anti-aliased lines inside a texture. This isn't for drawing lines on the screen (unless the texture fills the entire screen, of course). Line 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 ".Line". The arguments are:

"texture" is the texture you want to draw the line in, "x1" and "y1" are the x and y coordinates of the starting point of the line, "x2" and "y2" are the x and y coordinates of the ending point of the line, "color" is the color of the line. Lines drawn in the texture won't show up until Apply() is called; for speed reasons, this should be done last if more than one line is being drawn at once. A code example, which draws some random lines in a texture and results in something similar to the image above: