GA_GUIHelper.DrawLine C# (CSharp) Method

DrawLine() public static method

public static DrawLine ( Vector2 pointA, Vector2 pointB, Color color ) : void
pointA Vector2
pointB Vector2
color Color
return void
    public static void DrawLine(Vector2 pointA, Vector2 pointB, Color color)
    {
		if (Event.current == null)
            return;
 
        if (Event.current.type != EventType.repaint)
            return;
		
        if (clippingEnabled)
            if (!segment_rect_intersection(clippingBounds, ref pointA, ref pointB))
                return;

        if (!lineMaterial)
        {
            lineMaterial = new Material("Shader \"Lines/Colored Blended\" {" +

           "SubShader { Pass {" +

           "   BindChannels { Bind \"Color\",color }" +

           "   Blend SrcAlpha OneMinusSrcAlpha" +

           "   ZWrite Off Cull Off Fog { Mode Off }" +

           "} } }");

            lineMaterial.hideFlags = HideFlags.HideAndDontSave;

            lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
        }
 
        lineMaterial.SetPass(0);
		
        GL.Begin(GL.LINES);

        GL.Color(color);

        GL.Vertex3(pointA.x, pointA.y, 0);

        GL.Vertex3(pointB.x, pointB.y, 0);

        GL.End();
    }
};

Usage Example

Beispiel #1
0
    void DrawColorBoxes(Vector2 vect1, Vector2 vect2, Color col1, Color col2, int width, int height, float scrollPos, int number)
    {
        Debug.Log(scrollPos);
        if (scrollPos + 12 < 21 * number && scrollPos + 92 > 21 * number)
        {
            for (int i = 0; i < height; i++)
            {
                GA_GUIHelper.DrawLine(vect1 + new Vector2(0, i), vect1 + new Vector2(width, i), col1);
            }

            for (int i = 0; i < height; i++)
            {
                GA_GUIHelper.DrawLine(vect2 + new Vector2(0, i), vect2 + new Vector2(width, i), col2);
            }
        }
    }
All Usage Examples Of GA_GUIHelper::DrawLine