DirectX 9 Tutorials – #00 – Introduction

For this tutorials, we’ll need to download the DirectX SDK and a compiler. Since most of the header files are full of Microsoft-specific stuff, the only compiler that will work out-of-the-box is Visual C++. Starting from the 2005 version, Microsoft began to release freeware editions of their development products. In this tutorial, we’ll download and install Visual C++ 2008 Express Edition, but you can use any version you like.

The Express Editions can be obtained from http://www.microsoft.com/express/. Downloading the installer should take little time, but you will have to stay online while it is running, because it needs to download the components from the website. During the wizard, you can select what you want to install; the optional products (Microsoft SQL Server Express Edition and Silverlight) are not required to follow the samples, so you can skip them to save disk space and bandwidth.

Go take a coffee, it will take some time to download and install everything; eventually, it will ask you to restart the computer.

Visual C++ 2008 Express Edition - Setup

Visual C++ 2008 Express Edition - Setup

The setup will also install a basic platform SDK (now called Windows SDK); it should be enough for us, but if you want you can download the latest version from the Microsoft website. Here is a sample “hello world” application you may copy and paste inside Visual C++ to see if everything is working as expected.

#include <windows.h>
#include <tchar.h>

INT WINAPI _tWinMain(HINSTANCE hiProgram, HINSTANCE, LPTSTR tstrCmdLine, INT iCmdShow)
{
	MessageBox(NULL, _T("Hello world!"), _T("Greetings!"), MB_OK);
	return 0;
}

Now we just need the DirectX SDK; it can be downloaded from http://msdn.microsoft.com/en-us/directx/default.aspx. This time the setup application is pretty heavy (should be around 500 MB), but it can be installed without an internet connection. I suggest you to at least install the runtime libraries, the debug symbols, the headers/libraries (of course) and the samples (they may come in handy). The documentation can also be accessed online from the Microsoft website.

The setup program should automatically set the additional library and header directories of the compiler. To be sure the configuration is right, we must open the Tools/Options menu from Visual C++ and check for the VC++ Directories page under the Project and Solutions voice. The following is the configuration the installer set for me on my copy of Visual Studio 2008 Standard Edition.

Visual Studio 2008 Standard Edition - Include directories

Visual Studio 2008 Standard Edition - Include directories

Visual Studio 2008 Standard Edition - Library files (x86)

Visual Studio 2008 Standard Edition - Library files (x86)

Visual Studio 2008 Standard Edition - Library files (x64)

Visual Studio 2008 Standard Edition - Library files (x64)

I noticed that if you’re using Visual C++ 2008 Express Edition the setup will also add an executable directory to the configuration; this didn’t happen for the normal edition of Visual Studio.

Visual C++ 2008 Express Edition - Additional executable directories

Visual C++ 2008 Express Edition - Additional executable directories

Your computer should now be ready to compile the samples, you can then skip to the next tutorials.