0

I'm attempting to draw a 2d circle in C# using Managed DirectX. (yes it is outdated, and unsupported, i know)

Every single example i could find on the web is in C++. They use things like D3DTLVERTEX, Which my C# library does not seem to have. I have no clue how to convert Directx C++ to Directx C# as the seem to be very syntactically different.

I am using this simple method to draw a rectangle in C#

public static void DrawFilledBox(float x, float y, float w, float h, Color   Color)
    {
        Vector2[] vLine = new Vector2[2];

        line.GlLines = true;

        if (h < 1)
            h = 1;
        if (w < 1)
            w = 1;

        line.Width = w;

        vLine[0].X = x + w / 2;
        vLine[0].Y = y;
        vLine[1].X = x + w / 2;
        vLine[1].Y = y + h;

        line.Begin();
        line.Draw(vLine, Color.ToArgb());
        line.End();
    }

I have tried again and again to draw a circle with no success. It doesn't matter to me if the circle if filled or just a circle outline. Thanks.

LegitGodmode
  • 39
  • 1
  • 6
  • have you thought of using XNA/C#, its no longer supported but at least provides a more meanigful wrapper behind what you would be trying to do –  Nov 29 '16 at 20:18

1 Answers1

0

Direct3D is not a good choice for "drawing a circle" whether you are using an ancient deprecated C# managed wrapper or a newer one.

Direct2D is much more suited to vector graphics such as smooth circles. You can use Win2D, SharpDX, or SlimDX to use Direct2D from C#.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81