Beginner's Guide to DirectX
-
I'm a complete beginner with C++. I'm trying to get some sample programs that use DirectX (specifically DDraw) to compile using VC++ 6, but it's making my head hurt. Is there an idiot's guide to exactly what I have to do set everything up? Or can someone help me? So far I've: Downloaded & installed DirectX SDK 10 Fired up VC++ 6 and: Tools\Options\Directories - added the \SDK\Include path to the "Include files" drop down & added the \SDK\x64 and \SDK\x86 paths to the "Library files" drop down Project\Settings\Link - added "ddraw.lib" to the "Object/Library modules" Obviously something's wrong though, as the sample I'm trying to compile comes back with a "error C2146: syntax error : missing ';' before identifier 'lpdd'" when it gets to the first of the list of externals ("extern LPDIRECTDRAW4 lpdd; ") I've combed the web to the best of my ability and there seems to be lots of advice on setting up Borland and DevC++ to use DirectX, but I can't find a word about Visual C - I assume I'm being stupid.
-
I'm a complete beginner with C++. I'm trying to get some sample programs that use DirectX (specifically DDraw) to compile using VC++ 6, but it's making my head hurt. Is there an idiot's guide to exactly what I have to do set everything up? Or can someone help me? So far I've: Downloaded & installed DirectX SDK 10 Fired up VC++ 6 and: Tools\Options\Directories - added the \SDK\Include path to the "Include files" drop down & added the \SDK\x64 and \SDK\x86 paths to the "Library files" drop down Project\Settings\Link - added "ddraw.lib" to the "Object/Library modules" Obviously something's wrong though, as the sample I'm trying to compile comes back with a "error C2146: syntax error : missing ';' before identifier 'lpdd'" when it gets to the first of the list of externals ("extern LPDIRECTDRAW4 lpdd; ") I've combed the web to the best of my ability and there seems to be lots of advice on setting up Borland and DevC++ to use DirectX, but I can't find a word about Visual C - I assume I'm being stupid.
I believe DirectDraw isn't officially supported since DX8. That means you still can use it, but you won't find documentation for it (last is in DX7 SDK I believe). Make sure you're on WXP as AFAIK that's what DX10 needs. Also, I believe LPDIRECTDRAW4 is surely older interface than necessary, try LPDIRECTDRAW7 or LPDIRECTDRAW6. As for setting up VC 6.0: set up the prober include and library directories as you did. Move them both to the top of the list! Otherwise, it won't work (at least with DX8 I've been using). You also need to link some libs... like ddraw.lib and maybe dxguid.lib, depending on what parts of DX you use (look in the libs directory and use common sense). I believe you should better use D3D to draw graphics. As for links, gamedev.net has some nice articles and good forums for this kind of stuff (in the forum FAQ for D3D, you can even find links to some page that has older SDK for download if you want DD documentation). A nice tutorial is at http://www.andypike.com/tutorials/ . If you just want to do 2D with D3D, look up Sprites in the SDK. Also, there are some nice tutorials in the SDK's help files. Haven't touched DX since DX8/9, so if there's something new specifically to DX10, sorry :(
-
I believe DirectDraw isn't officially supported since DX8. That means you still can use it, but you won't find documentation for it (last is in DX7 SDK I believe). Make sure you're on WXP as AFAIK that's what DX10 needs. Also, I believe LPDIRECTDRAW4 is surely older interface than necessary, try LPDIRECTDRAW7 or LPDIRECTDRAW6. As for setting up VC 6.0: set up the prober include and library directories as you did. Move them both to the top of the list! Otherwise, it won't work (at least with DX8 I've been using). You also need to link some libs... like ddraw.lib and maybe dxguid.lib, depending on what parts of DX you use (look in the libs directory and use common sense). I believe you should better use D3D to draw graphics. As for links, gamedev.net has some nice articles and good forums for this kind of stuff (in the forum FAQ for D3D, you can even find links to some page that has older SDK for download if you want DD documentation). A nice tutorial is at http://www.andypike.com/tutorials/ . If you just want to do 2D with D3D, look up Sprites in the SDK. Also, there are some nice tutorials in the SDK's help files. Haven't touched DX since DX8/9, so if there's something new specifically to DX10, sorry :(
Thanks very much indeed - moving the includes to the top of the list did the trick. Maybe in years to come I'll understand exactly what the linker is doing, when & why.... And thanks for all the other tips. I'm only using LPDIRECTDRAW4 because I'm cutting and pasting samples from an old Andre Lamothe book (Tricks of the Windows Game Programming Gurus). I'll try updating it and thanks too for the link.:-D