Skip to main content
gamedev.net
🔒 Locked

Is it a good idea to use both C# and C++ with DirectX

Started by EmperorXYZ 3 replies 1.1k views
Original Post
EmperorXYZ
EmperorXYZ
Reason for asking: I've recently learned C# and really like it. It's just that I've been able to find ressources explaining well the BLC. I'm sure C++ also have similar libraries, but from how difficult it was for me to start learning Boost, I'd rather use C#.

So, I was wondering if that would be a good idea or there are hidden reasons, such as performance issues or lack of compatibility. I was planning on using C++ DLLs to make DirectX calls and use C# for game logic and pretty much everything else.
Ripiz
Ripiz
You don't need to learn or use Boost for C++. Personally I don't think it provides anything useful.

C# isn't much slower than C++ as far as I know. There's no need to create C++ library either, you could use something like XNA (http://create.msdn.com/en-US/), and I'm sure C# has a way to use DirectX (I'm not using it, so I do not know how to do that).
frob
frob
Yes, you can mix C# and C++. They are compiled into object files and you can link them together however you please.

There is no reason to just use C++ as a wrapper. Not only do you have XNA, but there are other projects like SlimDX that already handle it for you.
MJP
MJP
Interop between C# and C++ can be a major pain in the ass, and I don't suggest putting yourself through it if you don't have to. Libraries like SlimDX and SharpDX have already done all of the hard work of wrapping DX, so if that's your goal then you should consider using those instead.
EmperorXYZ
EmperorXYZ
I see thanks. Well, I'm still at the learning phase and I'd like to write a project or two where I'd have to go fairly low level with DirectX. After that, I'm all for less painful code writting. I'll check out SlimDX, SharpDX or XNA once I have a fairly solid grasp on how DX works. I'm also wondering about DXUT as even if I'm writting a complete C++ project, I still want shortcuts.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.