2D XNA Primitive Shapes

XNA does not include built-in functions to draw primitive shapes like: lines, rectangles, filled rectangles, circles, arcs, and pixels. This library has all of those. You can download the DLL and the source code from me and Gary's project on Bitbucket. There is also some documentation describing the different methods in the wiki.

This project does not allow you to draw pies, but I found this project that does: http://www.catalinzima.com/samples/12-months-12-samples-2008/2d-pie-drawing/

Comments:

  • Victorat 2012-10-15 07:44:43

    Hey John,

    i've just downloaded the new DLL and it works!

    I'll be using it during this week..

    Thank you!!

    Reply to comment

  • Victorat 2012-10-12 08:03:18

    Thanks John!

    That sounds great, I'm looking forward for it.


    Victor.

    Reply to comment

    • John McDonaldat 2012-10-13 14:20:50

      Hi Victor,

      I've uploaded r12 to bitbucket. It contains a new WP7 project & DLL that should work for you. Let me know if you have any issues.

      John

      Reply to comment

  • Victorat 2012-10-04 19:19:49

    Hi, I`ve downloaded the library but it won`t compile my game. it says can`t find the C3.XNA namespace.

    Is it compatible with a WP7 project?

    thanks.

    Good job.

    Reply to comment

    • John McDonaldat 2012-10-10 23:26:41

      Hi Victor,

      It should be compatible with a WP7 project, although I haven't tried. I think all you need to do is add the library under the References by
      - Right-clicking the "References" folder
      - Click "Add Reference" and select the "Browse" tab
      - Browse for "C3.XNA.Primitives2D.dll" and click "Ok"
      Once the project is imported, you'll need to "include C3.XNA.Primitives2D" to each source file that you want to use this in, but I'm guessing you've already done that, and that's what's throwing the error.

      If this project isn't compatible with WP7, I'd like to know so that I can fix it, or find someone who is able to fix it. So please get back to me. Thanks

      John

      Reply to comment

      • Victorat 2012-10-11 09:49:01

        Hi John,

        indeed I have included the DLL as a reference in my project. I just tried again (in case I made a mistake that day), but same thing happens:

        1. Include the DLL as a reference in the project - OK
        2. Add the using statement: VS won't allow me to add the following statement:

        using C3.XNA.Primitives2D

        it only allows me to add:

        using C3.XNA;


        When I type a dot (.) after the XNA, nothing shows up.

        With the reference added and the using statement above, I get the following errors (hope it helps):



        Error 1 The type or namespace name 'C3' could not be found (are you missing a using directive or an assembly reference?) C:\Temp\projects\HTB\HTB\HTB\Game1.cs 16 7 HTB


        Warning 3 The primary reference "C3.XNA.Primitives2D" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "C3.XNA.Primitives2D" or retarget your application to a framework version which contains "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". HTB

        Warning 2 The primary reference "C3.XNA.Primitives2D" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "C3.XNA.Primitives2D" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". HTB

        Reply to comment

        • John McDonaldat 2012-10-11 19:16:54

          Hi Victor,

          I just installed the WP7 SDK, and I get the exact same error & warnings as you did. I'll see if I can make a new DLL for you, and all the other WP7 users out there. Thanks for letting me know about this.

          John

          Reply to comment

Post your comments...