Microsoft DirectX 9.0


The Microsoft?DirectX?AppWizard creates a small C++ template application that can integrate the common DirectX components: Microsoft Direct3D? Microsoft DirectInput? Microsoft DirectMusic? Microsoft DirectSound? and Microsoft DirectPlay? It provides basic functionality that is easy to build on and demonstrates the use of each component.

Along with the template, AppWizard includes the same C++ classes found in the DirectX software development kit (SDK) common directory. These C++ classes perform minimal wrapping of DirectX to get you up and running quickly. All the DirectX SDK samples make use of these classes. For example, the Direct3D samples use D3dapp.*, the DirectMusic samples use Dmutil.*, the DirectSound samples use Dsutil.*, and the DirectPlay samples use Netconnect.*.

The AppWizard target audience is amateur C++ game developers, 3-D hobbyists, and audio hobbyists (who do not need 3-D).

Running AppWizard

AppWizard is launched from Microsoft Visual Studio?6.0 when you create a new project. It is one of the project types available when you choose File, New, and then the Projects tab, as shown in the following example.

Projects tab in the New box

When you enter a project name and click OK, the wizard presents a series of dialog boxes to allow you to configure the DirectX services that the application will need. The number of dialog boxes generated by the wizard depend on which DirectX technologies you select (Direct3D, DirectInput, and DirectPlay each generate their own dialog boxes). The files included in the project depend on the DirectX technologies selected, as well as the Microsoft Windows?technologies selected—Microsoft Win32? Microsoft Foundation Classes (MFC), and Windows Graphics Device Interface (GDI). You select these technologies on the first page of the wizard, which is shown in the following example.

Step 1

The wizard has three steps: Step 1 is the opening page, step 2 is the Direct3D page, and step 3 is the DirectInput page. The DirectMusic and DirectSound options do not generate additional pages but the DirectPlay Peer-to-Peer option will generate an additional page.

The wizard uses one of four base templates, based on the options you select.

The Direct3D, DirectInput, and DirectPlay check boxes each add another page to the wizard. These pages are described in the following sections.

Direct3D Page

The following Direct3D page is shown immediately after the first page if you selected the Direct3D check box in step 1.

Step 2

The Direct3D page is step 2 because step 1 was the first page of the wizard.

The Direct3D exclusive options are:

  1. Blank. No Direct3D object is created.
  2. Triangle. Creates a simple object with two back-to-back triangles.
  3. Teapot. Creates a complex object using D3DXCreateTeapot.

If Direct3D fonts is checked, the project includes D3dfont.cpp and D3dfont.h. Otherwise, the project uses D3DXCreateFont to display 3-D fonts.

If 3D meshes is checked, the project includes D3dfile.cpp and D3dfile.h.

DirectInput Page

The following DirectInput page is shown immediately after the Direct3D page if you selected the DirectInput check box in step 1.

Step 3

The DirectInput page is step 3. The options on this page are:

If you checked DirectInput in step 1, the project will include Diutil.cpp and Diutil.cpp files. The DirectX SDK sample, (SDK root)\Samples\bin\Donut3D.exe, uses these class files.

The application will use either Action Mapper or a keyboard device object to record key state. If neither is checked, DirectInput will use WM_KEYDOWN messages to record key state.

DirectMusic and DirectSound Check Boxes

These check boxes appear on page 1 of the wizard. They do no add pages to the wizard.

If DirectMusic is checked, the project will include Dmutil.cpp and Dmutil.h. The DirectMusic samples use these files.

If DirectSound is checked, the project will include Dsutil.cpp and Dsutil.h. The DirectSound samples use these files to load and play sounds.

If both DirectMusic and DirectSound are checked, DirectMusic is used to load and play the sounds, but Dsutil.* is still included in the project.

If either DirectMusic or DirectSound is checked, Bounce.wav is included in the project. Pressing the A key will play the sound.

If neither DirectMusic nor DirectSound is checked, Bounce.wav is not included and the A key is not recorded, nor is the Help string displayed.

DirectPlay Page

The following DirectPlay page is shown immediately after the DirectInput page if you selected the DirectPlay Peer-to-Peer check box in step 1.

Step 4

The DirectPlay page is step 4, assuming that step 1 was the first page of the wizard, step 2 was the Direct3D page, and step 3 was the DirectInput page.

If DirectVoice is checked, the project will include Netvoice.cpp and Netvoice.h. The DirectPlay Voice samples use these files.

The project will integrate the NetConnect DirectPlay connection dialog boxes into the application. When the NetConnect dialog boxes finish, an active DirectPlay connection or failure results. If successful, the arrow key state is passed between all players using DirectPlay.

If DirectInput Action Mapper is used, DirectPlay sends the axis data across the network; otherwise it sends the state of the four arrow keys.

© 2002 Microsoft Corporation. All rights reserved.