Jump to content
  • Advertisement
Sign in to follow this  
Guest

Question about c,c++,direct x and game development

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

Guest
In the creation of a game i see most developers use c++. I just have a few questions that need answering 1)I see WoW uses the C Language and direct x graphics. I thought direct X couldnt be used in C so how would they go about doing this? 2) In directX programming is there a tutorial/way to use normal C++ with the Win32 part of the programming?

Share this post


Link to post
Share on other sites
Advertisement
I think you have a few confusions about what Direct X and Win32 is exactly.

DirectX is basically just some libraries that serve as an intermediary between your code, and the hardware. Back in the day the games had to have special code for all different types of hardware, there was no abstraction so if the game didn't directly support some kind of hardware, you were SOL. DirectX came, and provided one interface to access any different kind of hardware, and if the hardware didn't support something then it could tell you, and possibly try and emulate the functionality with software.

Win32 is another library, and it allows your application to interact with the windows operating system. This entails things like making windows, receiving messages, etc...

Now for your questions:

1) I'm wager that WoW uses C++. Any large project nowadays is going to be using object oriented programming, it's just too essential to creating manageable software. DirectX is built on COM, which requires C++, so you could not use it with C, I believe. Keep in mind though, that C++ is pretty backwards compatible with C, so you could write and compile C code with a C++ compiler, and use C++ libraries with your C code.

2) Win32 and DirectX are "normal C++". They are just libraries, they can be accessed by any language. Visual Basic, Delphi, Python, Etc... can all use Win32 and DirectX. Not sure exactly what you're asking here.

Share this post


Link to post
Share on other sites
Quote:
Original post by cclyde
DirectX is built on COM, which requires C++, so you could not use it with C, I believe.


No, COM can be used with C. That's why the header files are built with all those mental macros. You basically end up calling free functions and passing the equivalent of this as a normal parameter.

It's awkward but it can be done.

Share this post


Link to post
Share on other sites
Quote:
Original post by cclyde
Win32 and DirectX are "normal C++". They are just libraries, they can be accessed by any language. Visual Basic, Delphi, Python, Etc... can all use Win32 and DirectX. Not sure exactly what you're asking here.


Actually, it is extremely difficult to get DirectX to work with older Borland Win32 compilers. I'm not entirely sure why this is but this was what made me migrate from Borland to Visual C++.

And yes, you can mix C and C++ code very easily. You might have to typecast certain data and at worst wrap some code in "extern C" but they are very compatible. In fact, I mostly use standard C with C++ only being used for the class portion.

Share this post


Link to post
Share on other sites
Quote:
Original post by cclydeyou could ... use C++ libraries with your C code.


Um, maybe you mean use C libraries with C++ code?

Share this post


Link to post
Share on other sites
Quote:
Original post by harminal
In the creation of a game i see most developers use c++. I just have a few questions that need answering

1)I see WoW uses the C Language and direct x graphics. I thought direct X couldnt be used in C so how would they go about doing this?

2) In directX programming is there a tutorial/way to use normal C++ with the Win32 part of the programming?


World of Warcraft is written in C++, not C.

Share this post


Link to post
Share on other sites
Quote:
Original post by Flimflam
Quote:
Original post by harminal
In the creation of a game i see most developers use c++. I just have a few questions that need answering

1)I see WoW uses the C Language and direct x graphics. I thought direct X couldnt be used in C so how would they go about doing this?

2) In directX programming is there a tutorial/way to use normal C++ with the Win32 part of the programming?


World of Warcraft is written in C++, not C.


C++ is just a superset of C. I wouldn't read to much into semantics. I know of no commercial compilers this day and age that are exclusively C or exclusively C++. Every modern compiler I've seen has supported both and often support ASM too.

Share this post


Link to post
Share on other sites
Its not semantics because they are two different languages (which is why I cringe when someone says C/C++) and really should be treated as such.

C is C, C++ is C++. Compilers might well deal with both however that doesn't make them the same thing and it disappoints me that people working in a field which requires precision and correctness ignore this simple fact.

If anything, this mixing of C and C++ is probably partly to blame for so much bad C++ existing because people treat C++ as 'C with classes' and end up writing bad code and missing out on the many features of C++ which would allow them to write better programs; both in code quality and execution speed.

So, yes, the semantics are important.

(also, while there might well be support for C89, C99 is alot less widespread. Afaik VC++ doesn't support it even in VS 2010)

Share this post


Link to post
Share on other sites
Quote:
Original post by phantom
Its not semantics because they are two different languages (which is why I cringe when someone says C/C++) and really should be treated as such.

C is C, C++ is C++. Compilers might well deal with both however that doesn't make them the same thing and it disappoints me that people working in a field which requires precision and correctness ignore this simple fact.

If anything, this mixing of C and C++ is probably partly to blame for so much bad C++ existing because people treat C++ as 'C with classes' and end up writing bad code and missing out on the many features of C++ which would allow them to write better programs; both in code quality and execution speed.

So, yes, the semantics are important.

(also, while there might well be support for C89, C99 is alot less widespread. Afaik VC++ doesn't support it even in VS 2010)

Well I know VS2008 had poor to nonexistent C99 support from the little bit I tried to use.

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!