Microsoft DirectX 8.1 (C++)

Application Wizard

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, easy-to-build-upon functionally 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, then the Projects tab, as shown in the following example.

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 Graphics Device Interface (GDI). You select these technologies on the first page of the wizard, which is shown in the following example.

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.

  1. For an application that is not MFC-based and uses Direct3D, choose Single document window and Direct3D. This is the standard case and is similar to the application used in the dolphin sample.

  2. For an application that is MFC-based and uses Direct3D, choose MFC dialog based and Direct3D. The application will be similar to the MFC fog sample.

  3. For a Windows application that uses GDI but not MFC, choose Single document window. This application can use CreateWindow and basic GameLoop during idle time.

  4. For an application that uses GDI and is MFC-based, choose MFC dialog based. The application will be similar to the MFC AppWizard dialog template.

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.

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 D3DXFont 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.

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, 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.

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.