Beispiel #1
0
    public static void DrawRect(Rect r, Color col)
    {
        //SR TODO Stuff a rect draw into the LineHelper clas
        Vector2 itemStartLine = new Vector2(r.x, r.y);
        Vector2 itemEndLine   = new Vector2(r.x + r.width, r.y);

        GUILineHelper.DrawLine(itemStartLine, itemEndLine, col);        //

        itemStartLine = new Vector2(r.x + r.width, r.y);
        itemEndLine   = new Vector2(r.x + r.width, r.y + r.height);
        GUILineHelper.DrawLine(itemStartLine, itemEndLine, col);        //

        itemStartLine = new Vector2(r.x + r.width, r.y + r.height);
        itemEndLine   = new Vector2(r.x, r.y + r.height);
        GUILineHelper.DrawLine(itemStartLine, itemEndLine, col);        //

        itemStartLine = new Vector2(r.x, r.y + r.height);
        itemEndLine   = new Vector2(r.x, r.y);
        GUILineHelper.DrawLine(itemStartLine, itemEndLine, col);        //
    }
Beispiel #2
0
    public static void DrawCurve(Vector2 start, Vector2 startDir, Vector2 end, Vector3 endDir, int segments, Color c)
    {
        Vector2 last = start;

        for (int i = 0; i < segments; ++i)
        {
            float   a    = ((float)i + 1.0f) / (float)segments;
            Vector2 next = CubicInterp(start, startDir, end, endDir, a);

            GUILineHelper.DrawLine(last, next, c);
            //Drawing.DrawLine( last, next, c, 2.0f, true );

            // If this is the last section, use its direction to draw the arrowhead.
            if ((i == segments - 1))
            {
                Vector2 dir = (next - last);
                dir.Normalize();
                DrawArrowhead(last, dir, c);
            }

            last = next;
        }
    }