Exemple #1
0
    public static void DrawRoundedBox(Rect box, float radius, Color color, float width)
    {
        Vector2 vector  = new Vector2(box.xMin + radius, box.yMin);
        Vector2 vector2 = new Vector2(box.xMax - radius, box.yMin);
        Vector2 vector3 = new Vector2(box.xMax, box.yMin + radius);
        Vector2 vector4 = new Vector2(box.xMax, box.yMax - radius);
        Vector2 vector5 = new Vector2(box.xMax - radius, box.yMax);
        Vector2 vector6 = new Vector2(box.xMin + radius, box.yMax);
        Vector2 vector7 = new Vector2(box.xMin, box.yMax - radius);
        Vector2 vector8 = new Vector2(box.xMin, box.yMin + radius);

        Drawing_tc.DrawLine(vector, vector2, color, width);
        Drawing_tc.DrawLine(vector3, vector4, color, width);
        Drawing_tc.DrawLine(vector5, vector6, color, width);
        Drawing_tc.DrawLine(vector7, vector8, color, width);
        float   num          = radius / 2f;
        Vector2 startTangent = new Vector2(vector8.x, vector8.y + num);
        Vector2 endTangent   = new Vector2(vector.x - num, vector.y);

        Drawing_tc.DrawBezier(vector8, startTangent, vector, endTangent, color, width);
        startTangent = new Vector2(vector2.x + num, vector2.y);
        endTangent   = new Vector2(vector3.x, vector3.y - num);
        Drawing_tc.DrawBezier(vector2, startTangent, vector3, endTangent, color, width);
        startTangent = new Vector2(vector4.x, vector4.y + num);
        endTangent   = new Vector2(vector5.x + num, vector5.y);
        Drawing_tc.DrawBezier(vector4, startTangent, vector5, endTangent, color, width);
        startTangent = new Vector2(vector6.x - num, vector6.y);
        endTangent   = new Vector2(vector7.x, vector7.y + num);
        Drawing_tc.DrawBezier(vector6, startTangent, vector7, endTangent, color, width);
    }
Exemple #2
0
    public static void DrawBezier(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, int segments)
    {
        Vector2 start2 = Drawing_tc.CubeBezier(start, startTangent, end, endTangent, 0f);

        for (int i = 1; i <= segments; i++)
        {
            Vector2 vector = Drawing_tc.CubeBezier(start, startTangent, end, endTangent, (float)i / (float)segments);
            Drawing_tc.DrawLine(start2, vector, color, width);
            start2 = vector;
        }
    }
Exemple #3
0
    public static void BezierLine(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, bool antiAlias, int segments, Rect screen)
    {
        Vector2 pointA = Drawing_tc.cubeBezier(start, startTangent, end, endTangent, 0f);

        for (int i = 1; i <= segments; i++)
        {
            Vector2 vector = Drawing_tc.cubeBezier(start, startTangent, end, endTangent, (float)i / (float)segments);
            Drawing_tc.DrawLine(pointA, vector, color, width, antiAlias, screen);
            pointA = vector;
        }
    }
Exemple #4
0
    public static void DrawBox(Rect box, Color color, float width)
    {
        Vector2 vector  = new Vector2(box.xMin, box.yMin);
        Vector2 vector2 = new Vector2(box.xMax, box.yMin);
        Vector2 vector3 = new Vector2(box.xMax, box.yMax);
        Vector2 vector4 = new Vector2(box.xMin, box.yMax);

        Drawing_tc.DrawLine(vector, vector2, color, width);
        Drawing_tc.DrawLine(vector2, vector3, color, width);
        Drawing_tc.DrawLine(vector3, vector4, color, width);
        Drawing_tc.DrawLine(vector4, vector, color, width);
    }
Exemple #5
0
 public static void DrawLine(Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias, Rect screen)
 {
     Drawing_tc.clippingBounds = screen;
     Drawing_tc.DrawLine(pointA, pointB, color, width);
 }