Advertisement

Switching Code

Started by March 21, 2000 08:06 PM
2 comments, last by Zipster 24 years, 11 months ago
I''ve been using LPDIRECTDRAW4 and LPDIRECTDRAWSURFACE4 in my code, but i recently saw some code that used LPDIRECTDRAW7 and LPDIRECTDRAWSURFACE7 (and worked). How would I convert the code I have now to this new (presumably DirectX 7.0) type? I tried just changing all the 4s to 7s, but I got some: ''LPDIRECTDRAW7'' : decl-specifier error or somthin''. I have the library files from DirectX, but it doesn''t work. What do I do to change this? Are they even any advantages, or just the fact that you use the latest technology in your software (with isn''t bad )
There''s not much reason to change the interfaces you use unless you specifically want to get some functionality that only DX7 interfaces support...Assuming you do:

First off, you need to have the DirectX 7 SDK installed.
If you don''t have it installed (if you''re not sure, you almost certainly don''t have it installed), go to http://msdn.microsoft.com/directx and download the SDK. It comes in two packages, one includes samples and documentation, one doesn''t. I''d suggest you get the full SDK, but you might have bandwidth problems, it''s about 128megabytes. The other version, with just the headers and libraries, is much smaller.

Once you install DirectX7, you need to make sure your compiler can find its headers and libraries. Assuming you are using Visual C++, go to the Tools\Options menu,
click the Directories tab. Add the appropriate library (you''ll find these where you installed the SDK under the ''lib'' directory) and include (you''ll find these under the SDK ''include'' directory) directories. You should use the directory ordering features of that dialog to put those directories at the top of the list, to avoid collisions with the (old) headers and libs that ship with Visual C++.

Then try compiling. Chances are, you''ll still get errors. Not all of the interfaces work exactly the same from release to release. On an error-by-error basis, you''ll have to look at the docs and/or headers to try and figure out what''s changed and how it affects your code. Or post the specific errors you get here.


Advertisement
To help deal with DirectX upgrade problems I''ve redefined all the DirectX types, interfaces, and GUIDs with my own. Like

#define MyDirectSoundBuffer IDirectSoundBuffer

This way I only need to change code in a few spots. Of course, if the actual use of the API changes (which it usually does) I HAVE to make code changes, but at least some of the other work is done almost automatically.

www.gameprojects.com - Share Your Games and Other Projects
Whoops! Im dumb! I knew I installed the SDK, but forgot to replace the old DirectX file headers with the new ones. Thanx anyway!

This topic is closed to new replies.

Advertisement