Jump to content
  • Advertisement
Sign in to follow this  
3Dgonewild

VC++ Express (some questions)

This topic is 4078 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

I need to create a small editor in opengl , but i don't want to waste time on writing a (bug-y) gui. So , my questions are: 1) Is it possible to add forms/menus/vcl objects in VC++?(like vc# for example) 2) How can i create an opengl window on the form? Also i want to add menus / buttons / status bars etc...is it possible? Thats all i need to know , thanks for your time. edited: Something that i forgot.. Can i write pure c++ code? or they did modifications??(like vc# for example)

Share this post


Link to post
Share on other sites
Advertisement
Re question 1, it is not possible to visually drag forms together like C# with unmanaged C++. I believe you can use Windows Forms stuff with managed C++ but I don't know what the implications for interfacing with OpenGL would be.

If you are looking to create the GUI elements with code, Express does not ship with MFC, but there are other cross-platform wrappers available that may help, such as wxWidgets.

I suspect that there is a C# solution in here somewhere as I'm sure you must be able to interface C# and OpenGL by now, but I'm sure someone else can advise better on this.

[EDIT] It would appear that there is some kind of C# OpenGL library.

For something like an editor that is GUI heavy, I'd really think this was worth investigating. I've only heard bad things about managed C++.

[Edited by - EasilyConfused on July 24, 2007 3:10:20 AM]

Share this post


Link to post
Share on other sites
Hey,

1) Yes. It has a windows form designer exactly like vc#.

2) I use directx, but i imagine the init procedure is kinda similar. You just need to make a window using the form designer, then get the handle of that window and pass it to Directx/opengl as the window to render in.

I've had no trouble creating a 'gui' using windows form components, and having that co-exist with directx on the same form. The buttons are painted on top of the rendering scene, so it works fine (so far).

As for the pure c++, yes you can. VC++ also gives you the (preferred) option of C++/CLI, which is essentially managed C++, complete with afew new pieces of syntax to learn.

You can have managed and unmanaged (native) classes co-exist in the same project without troubles, which is great because you can take advantage of .nets features and wrappers using the managed CLI stuff, and still write some code in good ol C++ if you want more control. Mixing the two directly, like having unmanaged variables/pointers in a managed class, can sometimes be abit quirky, but i've had no major problems yet.

More info on C++/CLI here.

Hope this helps.

[Edit] EasilyConfused pointed out some things i was not clear on. If you choose to use the windows form designer, you are forced to use C++/CLI, as it generates all managed code. If you want to use purely c++, then you cannot use the form designer like you do in c#, and have to make your own gui from scratch, without the help of MFC as EasilyC said.

Share this post


Link to post
Share on other sites
Quote:
Original post by 3Dgonewild
Can i write pure c++ code? or they did modifications??
There are compiler-specific extensions to the language and the standards compliance still isn't perfect, but it is very good and you shouldn't run into any issues writing standards-compliant C++.

Share this post


Link to post
Share on other sites
Thanks for the replies!




Quote:

2) I use directx, but i imagine the init procedure is kinda similar. You just need to make a window using the form designer, then get the handle of that window and pass it to Directx/opengl as the window to render in.



I just finished with the installation(VC++/SDK ..etc), and i really like the ide.
Its just like vc# , but you're actually coding in c++..

Well , can you please post a small example showing how you get the handle name?????


@ EasilyConfused :

Thanks , but i wanna give a chance to vc++ express.
If i cant do it there , i will go back to dev C++..(i dont wanna use c#)

Quote:

There are compiler-specific extensions to the language and the standards compliance still isn't perfect, but it is very good and you shouldn't run into any issues writing standards-compliant C++.

Thanks, i had no idea!

Share this post


Link to post
Share on other sites
Quote:

Well , can you please post a small example showing how you get the handle name?????


Sure.

To get the handle of a managed form, i do this.

HWND handle;
handle = (HWND)YourForm->Handle.ToPointer();

Handles aren't the same in managed C++ as in native C++, which is why the typecasting to HWND is necessary. This gives you a native handle you can pass into unmanaged code (i'm using unmanaged dx which is why this is necessary).

If your using all managed code i think you can just pass YourForm->Handle directly as a parameter.

Share this post


Link to post
Share on other sites
Quote:
Original post by Kazgoroth
Quote:
Original post by 3Dgonewild
Can i write pure c++ code? or they did modifications??
There are compiler-specific extensions to the language and the standards compliance still isn't perfect, but it is very good and you shouldn't run into any issues writing standards-compliant C++.

I was wondering about this the other day, do you know of anything that isnt fully standards compliant? I'd love to know what to avoid and why I'm avoiding it [wink]

Share this post


Link to post
Share on other sites
Quote:
Original post by supamike
Quote:

Well , can you please post a small example showing how you get the handle name?????


Sure.

To get the handle of a managed form, i do this.

HWND handle;
handle = (HWND)YourForm->Handle.ToPointer();

Handles aren't the same in managed C++ as in native C++, which is why the typecasting to HWND is necessary. This gives you a native handle you can pass into unmanaged code (i'm using unmanaged dx which is why this is necessary).

If your using all managed code i think you can just pass YourForm->Handle directly as a parameter.


Hmm , thanks , i'll give it a try later.

Also , something that i have to ask (sry for being a pain in the @$$) ..
Now , all i have to do is to create the window on the form using the "handle" variable?
Im asking because in my old code there are dmSETTINGS configuration , and i think it will mess up everything...

Share this post


Link to post
Share on other sites
Quote:
Original post by 3Dgonewild


Btw , how do you handle key presses ?!



Ok , because i see that no one cant help..
If i use getansikeystate() is it ok?
I mean , its working , but isnt it a lame solution ? (for an editor only--the game "engine" uses sdl).

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!