DirectX with Visual Studio 2005

Started by
11 comments, last by Chad Smith 18 years, 3 months ago
Firstly, Hello! I have been programming with VB for a few years, mainly using it for college projects. In the last 4 months I have been learning C/C++, creating console and windows applications (nothing to complicated, just getting used to pointers etc.) I decided a few weeks ago that I would like to try my hand at a bit of 2D game design, and if all goes well, maybe make some basic 3D games. I did not have a clue where to start, but after a short search I came accross DirectX SDK (December version). What I need help with is getting DirectX SDK to work with Visual Studio 2005. I downloaded and installed DirectX following the step-by-step instuctions on-screen, but I am at a loss as to how to use it with Visual Studio 2005. If anyone could give me a quick guide on exactly how to make a basic program using DirectX it would be very much welcomed. I have searched google for the last two weeks and cannot find out how to get a DirectX program up and running. (I think its largly because I don't know what i'm doing, and don't understand much todo with the subject) If anyone can help out a newb in need I would really appreciate it, thanks! :)
Advertisement
Did you look in the documentation for the DirectX SDK and/or Visual Studio 2005?

I haven't looked at Visual Studio 2005 personally, but it seems reasonable that there will be docs and tutorials available with the distribution. But Microsoft isn't always reasonable...

You might also look here:

http://msdn.microsoft.com/coding4fun/gamedevelopment/default.aspx

and also

http://www.drunkenhyena.com/cgi-bin/dx9.pl
Ok i've started the tutorial on the microsoft site. It seems exactly what I want, but straight away I have ran into a problem. It says:

"Select File | New | Project and choose Windows Application from the template list"

I do not have "Windows Application" on my Visual Studio 2005 list... These are some of the ones I have on my list:

Windows Forms Application
Win32 Console Application
MFC Application
Empty Project
Wind32 Smart Device Project
Test Project
CLR Console Application
ATL Project
Makefile Project
ATL Server Project
ATL Smart Device Project
CLR Empty Project
Win32 Project

Which one is he asking me to use? Sorry if its obvious.. I don't want to make a mistake this early on. Thanks :)
Win32 project, however, if you didn't know that, you might be getting ahead of yourself diving into Directx
Anti-Sig: Do Not Read This Signature
To get a windowed Win32 project you need to install the Platform SDK.
____________________________________Spazuh- Because I've had too much coffee
Hi there!

Setting up DirectX with VS 2005 shouldn't be very difficult.
First of all my recomandation would be to start from a DirectX workspace made by someone else. There are a lot of good tutorials on the Web that have a pre-made VS workspace. DirectX initialization is a large subject and can get tricky for those that are facing it for the first time. DrunkenHyena and 32Bits have nice DirectX tutorials.
Secondly you need the PlatformSDK to compile DirectX code. Download it from MSND and install it. After that add the DirectX SDK and Platfrom SDK Include folders to your VS project. Do the same with DirectX SDK and Platfrom SDK Lib folders. This is just a rough explanation if you get into trouble you can post your questions here.


Edit: One more thing: you also need to link to a couple of libraries. Add the folowing lines at the begining of your WinMain file.

#pragma comment(lib,"d3d9.lib")
#pragma comment(lib,"dxerr9.lib")
#pragma comment(lib,"dinput8.lib")
#pragma comment(lib,"dxguid.lib")

#pragma comment(lib,"user32.lib")
#pragma comment(lib,"gdi32.lib")
#pragma comment(lib,"winspool.lib")
#pragma comment(lib,"comdlg32.lib")
#pragma comment(lib,"ole32.lib")

This should cover everything.

[Edited by - Calin on February 9, 2006 2:20:07 AM]

My project`s facebook page is “DreamLand Page”

Seeing how C++ doesn't seem to be a requirement for your project (and that you haven't really gone to far with it yet), have you considered C#?

It has much the same syntax as C/C++ except it readily benefits from the .NET Framework and Managed DirectX.

Have a look around C-Unit.com. The author of this website has written tutorials for DirectX in both C++ and C#.
Thanks for all the help everyone. I read a couple of other topics and decided to give SDL a try using Dev-C++, instead of jumping into DirectX.

I've spent the last two days reading and playing with SDL, and have made two games. One is a kind of side-scroll shooter(very basic) and a Pong-like game. I will stick with this till i've learnt alot more, then i will hopefully move onto 3D graphics using DirectX.

Anyway thanks again for the info :)
(Calin, I'll keep those notes written down for when I come to use DirectX. Cheers)
Are you using an on-CD standard/pro/+ version of VS 2k5, or are you using the Express? A few things work out of the box except in Express, where you have to configure them by hand.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Hey jsolo,

You'll probably want to choose "Empty Project" from your list there. That's where I start for my game projects. However, you're going to have to create everything from scratch this way, including creating a Window for your program to run in. It sounds like you're definitely going to need some additional help, via online-tutorials and/or beginner game dev books. To incorporate DirectX, you'll be including different header files such as "d3d9.h" and "d3dx9.h".

#include <d3d9.h> (for example)

You'll also have to link your project to any required .lib files by going to projects/properties/linker/input/additional-dependencies (or something like that), and typing in d3d9.lib...

Good luck.

Nevermind as I just read your above post. LOL :-)

This topic is closed to new replies.

Advertisement