コード例 #1
0
ファイル: GUIExamplesStatic.cs プロジェクト: lochrist/UniVer
    /// <summary>
    /// Polygons Example
    /// </summary>
    private void DrawPolygons()
    {
        mRectangleY += mRectangleHeight + 20;
        Drawing2D.DrawRect(new Rect(mRectangleX, mRectangleY, mRectangleWidth, mRectangleHeight));
        Drawing2D.DrawText("Polygons", mRectangleX + 5, mRectangleY + 5, 18, Color.white, mBitmapFont);
        float x      = 15 - mSampleWidth;
        float y      = mRectangleY + 50;
        float radius = mRectangleHeight - 60;

        Drawing2D.DrawPentagon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(36, 86, 188), 2f, CustomTextureLines);
        Drawing2D.DrawHexagon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(93, 166, 221), 4f, CustomTextureLines);
        Drawing2D.DrawOctogon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y - 5), radius + 10, ToColor(21, 179, 89), 2f, CustomTextureLines);
        Drawing2D.DrawDashedPentagon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(175, 217, 141), 2f, 5);
        Drawing2D.DrawDashedHexagon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y), radius, ToColor(248, 222, 104), 4f, 4);
        Drawing2D.DrawDashedOctogon(new Vector2((x += mSampleWidth) + ((mSampleWidth / 2) - radius), y - 5), radius + 10, ToColor(255, 196, 126), 4f, 4);
        x += mSampleWidth + 20;
        Vector2[] vertices = new Vector2[6];
        vertices[0] = new Vector2(x - 10, y - 30);
        vertices[1] = new Vector2(x + 10, y - 15);
        vertices[2] = new Vector2(x + 100, y - 25);
        vertices[3] = new Vector2(x + 65, y + 25);
        vertices[4] = new Vector2(x + 0, y + 15);
        vertices[5] = new Vector2(x - 10, y - 10);
        Drawing2D.DrawPolygon(vertices, ToColor(255, 112, 92), 4f);
        x          += mSampleWidth;
        vertices    = new Vector2[6];
        vertices[0] = new Vector2(x - 10, y - 30);
        vertices[1] = new Vector2(x + 10, y - 15);
        vertices[3] = new Vector2(x + 100, y + 25);
        vertices[2] = new Vector2(x + 65, y - 25);
        vertices[4] = new Vector2(x + 0, y + 15);
        vertices[5] = new Vector2(x - 10, y - 10);
        Drawing2D.DrawDashedPolygon(vertices, ToColor(232, 62, 83), 2f, false, 3f);
    }