DigitalPenguin

Hey Guys,

Up until now, all of my projects have been written in cpp. I had a pretty descent game engine written based upon Ogre3D and several other libraries but I kinda abandond the project when xna was released.

Anyway though, Im currently still in the process of learning c# however, as soon as I have the language down pretty well, I want to go ahead and start recreating my game engine using xna instead. The only problem is, well, honestly, I'm just not good enough with my 3D maths and physics yet to create my own C# physics engine so I was hoping I could use the Novodex physics engine with C# although it's written in C++. Is this possible Can you #include the headers into your c# code Does the compiler still support c++ And last but not least, will the 360 even run unmanaged code

I have aleady tried to do some homework on this, but I haven't found much on the subject. Thanks a lot for any feedback.

-Jay




Re: XNA Framework using C++ libraries with C# and 360...

waruwaru

If you are working on Windows only (not xbox), and the C++ functionality you want to access is in a DLL. You can dllimport the functions in C# and use them. However, you have to come up with the proper function declarations yourself (or via google/whatnot). It can get tricky figuring out the proper parameters if you are not using the basic data types as function arguments. You might be interested in this article:

http://grammerjack.spaces.live.com/blog/cns!F2629C772A178A7C!156.entry






Re: XNA Framework using C++ libraries with C# and 360...

Ely

GSE only supports C# right now, and since XNA is running under a modified version of the .Net compact framework on the 360, you cannot use unmanaged code on the 360 with XNA.  The only option you would have at this time is porting the code over to C#.

If your game was only going to run on windows, you can do what the previous poster said about calling the c++ code directly.






Re: XNA Framework using C++ libraries with C# and 360...

break_r

Hi,

You won't be able to do this from the 360, but it's definitely doable from Windows. I wouldn't recommend using platform invocation from C# (although it's not terribly difficult). I prefer to use C++/CLI to create wrapper components and then consume them from C#. If you decide to wrap things up in C++/CLI, be careful not to expose any native return types or params in your interface.

I would also recommend downloading and reading the C++/CLI spec here.






Re: XNA Framework using C++ libraries with C# and 360...

Mateusz www.Kierepka.pl

C# is not ony one option. See here:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1104151&SiteID=1

I write there about samples: IronPython, F#, C++, VB.NET






Re: XNA Framework using C++ libraries with C# and 360...

Shawn Hargreaves - MSFT

Mateusz www.Kierepka.pl wrote:

C# is not ony one option. See here:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1104151&SiteID=1

I write there about samples: IronPython, F#, C++, VB.NET



IronPython, C++, and VB.NET programs will not run on Xbox, though.





Re: XNA Framework using C++ libraries with C# and 360...

DigitalPenguin

Im growing to love C# more and more everyday, however, it seems like kind of a bad move on MS's part not to support C++ on the 360 saying that 90% of all developers use C++. Haha, kinda seems like MS did this on purpose to help further push .net and cs, plus, I'd haven't yet looked into it, but I could take a wild guess and say that the competiting platforms do not support C# Pure evilness, but cool though ;) Alrighty, any suggestions about the physics system

Thnx.





Re: XNA Framework using C++ libraries with C# and 360...

Mateusz www.Kierepka.pl

Do you need 2D or 3D system

There are other 3D systems with physics if you need free or commercial say something .






Re: XNA Framework using C++ libraries with C# and 360...

Mateusz www.Kierepka.pl

Yes, you have right - only F# is runing now on 360.




Re: XNA Framework using C++ libraries with C# and 360...

Fluxtah

Im growing to love C# more and more everyday, however, it seems like kind of a bad move on MS's part not to support C++ on the 360 saying that 90% of all developers use C++. Haha, kinda seems like MS did this on purpose to help further push .net and cs, plus, I'd haven't yet looked into it, but I could take a wild guess and say that the competiting platforms do not support C# Pure evilness, but cool though ;) Alrighty, any suggestions about the physics system

I am sure there is an XBOX 360 SDK for C++ developers although I doubt you would be able to get access to it.