Sign in to follow this  

C++\CLR or C# wrapper for native c++ code for creating a MapEditor

This topic is 3041 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I want to make a Map Editor for my game TankWars with some complex GUI. Problem is i dont have required experience to make GUI using native c++ so i wanted to make GUI in C# or C++/CLI and connect them to native c++ classes and functions. I have native code ready but now i need to some how connect it to managed code. I did some searching on Net and found that i either need to use COM which i dont want to use or i have to create wrapper for native code. So please provide some useful tutorials,links anything useful that can help me learn how to make wrapper for native c++ code or if there is any other alternative please suggest me that too. [Edited by - Chetanhl on August 19, 2009 11:57:21 AM]

Share this post


Link to post
Share on other sites
You already listed C++/CLI. C++/CLI allows you to use native code in .NET without writing wrappers or going through COM. It's way faster than COM and a little faster than P/Invoke, too.

The drawback is that it's not portable. C++/CLI currently only works on Microsoft's .NET CLR on Windows and nowhere else.

Using P/Invoke would require you to create a pure C wrapper for your C++ code and then call the C wrapper functions in a .NET wrapper library. Not too complicated (unless you want to keep references .NET in your native code or call from native to .NET), but it's a lot of boilerplate code to write.

Maybe writing the GUI in C++ would be an option? There's Qt and WxWidgets. Qt is absolutely free now (Nokia bought them) and is just as productive as Visual Studio w/ WinForms designer.

Share this post


Link to post
Share on other sites
http://www.gamedev.net/reference/programming/features/D3DCsharpWinform/

this tutorial is ideal for what you want to do, I used it myself.

I have mutated that tutorial to do all kinds of things, including bridging C# and my engine using Lua.

The thing about this is that you need some way of creating objects in your engine... and exposing that functionality in the wrapper, which C# can use to create or load your tank assets.

Share this post


Link to post
Share on other sites

This topic is 3041 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this