Jump to content
  • Advertisement
Sign in to follow this  
i24021

UI in C# with c++ or only c++ ?

This topic is 4834 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'm starting my way into the wonderfull world of directx 9.0 :-). I have a great experience in c# and java but almost none in c++. I've already decided to learn c++ and i'm making great progress. But before i start my project i was wondering if it's possible to build the external shell of my program with C# (because it's easier to build ui's in windows forms) and the rest with pure c++ with directx 9.0. Maybe inside a panel. I would like to use this shell to configure parameters in my project. I don't know even if this is the best way... I have read that WTL is a good library for windows interfaces and besides i can always use MFC or even to change the settings in the context of the demo using some controls drawn to emulate the tradicional controls in windows... What is the best way to do something like this ? Tnks in advance

Share this post


Link to post
Share on other sites
Advertisement
I dont know anything about c# so this may be way wrong. But I would assume there is a c# way to import functions from a dll. if that possible you could just write all your c++ stuff in a dll and call it from c#. All you need to pass to directx is an hwnd i think. I could be way off though I have done something similar in visual basic.

Share this post


Link to post
Share on other sites
Save yourself the trouble and don't do it, Either do it all in C#, or all in C++... you could ofcourse use the WinForms in Managed C++.

Share this post


Link to post
Share on other sites
Quote:
Original post by Arelius
Save yourself the trouble and don't do it, Either do it all in C#, or all in C++... you could ofcourse use the WinForms in Managed C++.


Ok, and what is the best gui library in C++ ? It's hard to decide there's a lot of implementations...

Share this post


Link to post
Share on other sites
OP > Any quick and dirty tools you need, you may as well develop in C# as you are already familiar.

As for C++ using C#... well that will mean you will need the .Net runtime regardless (obviously).

If I were to take that approach (C# for some of the UI), I would go the ActiveX / COM route. C++ should be able to use C# COM / ActiveX controls as it would any other COM control.
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=187

This partition of responsibility between view and business logic would probably actually be pretty useful in terms of a decent design actually.

If you are lucky enough to have Visual Studio .Net - I would try and learn the forms designer stuff built in to Visual C++ .Net. http://www.codeproject.com/ has tons of tutorials for C++ and C#.

As for graphics libaries, unless you are concerned with cross platform stuff then you may as well just use the MFC (eek) and whatever else is in Visual Studio... as the MSDN has tons of tutorials on how to get stuff done, and the DirectX SDK has loads of UI examples too.

As another poster said though, this is probably creating unnecessary headaches for yourself - COM is not an easy subject, though you are already using it if you are using DirectX. It's probably best to just keep to C++ if that's your chosen language.

Share this post


Link to post
Share on other sites
Quote:
Original post by paulecoyote
OP > Any quick and dirty tools you need, you may as well develop in C# as you are already familiar.

As for C++ using C#... well that will mean you will need the .Net runtime regardless (obviously).

If I were to take that approach (C# for some of the UI), I would go the ActiveX / COM route. C++ should be able to use C# COM / ActiveX controls as it would any other COM control.
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=187

This partition of responsibility between view and business logic would probably actually be pretty useful in terms of a decent design actually.

If you are lucky enough to have Visual Studio .Net - I would try and learn the forms designer stuff built in to Visual C++ .Net. http://www.codeproject.com/ has tons of tutorials for C++ and C#.

As for graphics libaries, unless you are concerned with cross platform stuff then you may as well just use the MFC (eek) and whatever else is in Visual Studio... as the MSDN has tons of tutorials on how to get stuff done, and the DirectX SDK has loads of UI examples too.

As another poster said though, this is probably creating unnecessary headaches for yourself - COM is not an easy subject, though you are already using it if you are using DirectX. It's probably best to just keep to C++ if that's your chosen language.


Ok tnks a lot for your help i will try to do everithing in C++ probably with MFC

Share this post


Link to post
Share on other sites
I've heard of people creating their interface using Visual Basic (because it's so easy to do), and writing the back end of their program in a C++ DLL.

I have absolutely no experience of writing DLLs though, but it's just a thought.

HTH,

ukdeveloper.

Share this post


Link to post
Share on other sites
wtf is wrong with you? you know c#, can do UI there, want to learn c++ and you will now start using MFC? sounds like you are going backwards to the stonge age. next thing you want to do is using assembler for everything?

there is no need to use 2 languages simultaneously, you will have a lot of troubles passing stuff over. sometimes it can be helpful to write some smaller parts in c++ (libraries, low level hardware access) and call in in c# or the other way around (you have your engine in c++ and write tools in c# because it is faster).

but i never heard from anyone coming from c# going to c++ just to use MFC. there must be something wrong here.

Share this post


Link to post
Share on other sites
Quote:
Original post by abnormal
wtf is wrong with you? you know c#, can do UI there, want to learn c++ and you will now start using MFC? sounds like you are going backwards to the stonge age. next thing you want to do is using assembler for everything?

there is no need to use 2 languages simultaneously, you will have a lot of troubles passing stuff over. sometimes it can be helpful to write some smaller parts in c++ (libraries, low level hardware access) and call in in c# or the other way around (you have your engine in c++ and write tools in c# because it is faster).

but i never heard from anyone coming from c# going to c++ just to use MFC. there must be something wrong here.


It's a simple problem, i know that c++ is THE language to program games. So i need to learn c++ and i'm doing it. But now i need to do a GUI to set some properties like for example: use antialising, use anisotropic filtering in what level and so on. I want to see these changes in a panel or something like that with my 3d scene. I want to build something like the EfectEdit utility that cames with directx sdk.

There is 4 ways to do that :
- Use Managed directx and windows forms (it's easy since i know windows forms programming very well) (Not what i want since using c++ is a requisite)
- Use some api in c++ for the GUI and the engine
- A mix of the two choices
- Implement the controls in directx 9.0

What i want to know is the best way to do it...

Tnks in advance

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!