Created
January 8, 2021 17:05
-
-
Save unitycoder/90f0f1896e38a13d98e3d0c84ea45789 to your computer and use it in GitHub Desktop.
Revisions
-
unitycoder created this gist
Jan 8, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // old unityscript function drawLine(x0:int, y0:int, x1:int, y1:int) { dx= Mathf.Abs(x1-x0); dy= Mathf.Abs(y1-y0); if (x0 < x1) {sx=1;}else{sx=-1;} if (y0 < y1) {sy=1;}else{sy=-1;} err=dx-dy; loop=true; while (loop) { texture.SetPixel (x0,y0,Color(1,1,1,1)); if ((x0 == x1) && (y0 == y1)) loop=false; e2 = 2*err; if (e2 > -dy) { err = err - dy; x0 = x0 + sx; } if (e2 < dx) { err = err + dx; y0 = y0 + sy; } } texture.Apply(); }