The first step in setting up DirectDraw and Direct3D for the RoadRage application is to define a structure that we'll use to hold all the information about the Direct3D devices we enumerate on the host system. By retaining this information in our own data structure, we can easily present a dialog box to users that will show them what devices and modes are available and let them switch between them. The structure we'll use holds the Direct3D device information, the DirectDraw device information, and the DirectDraw mode information. The D3DEnum_DeviceInfo structure, which works well for this purpose, is defined in d3denum.h as follows:
//------------------------------------------------------------------- // Name: Structure D3DEnum_DeviceInfo // Desc: Structure to hold information about the enumerated // Direct3D devices //------------------------------------------------------------------- struct D3DEnum_DeviceInfo { // Direct3D device information CHAR strDesc[40]; GUID* pDeviceGUID; D3DDEVICEDESC7 ddDeviceDesc; BOOL bHardware; // DirectDraw driver information GUID* pDriverGUID; DDCAPS ddDriverCaps; DDCAPS ddHELCaps; // DirectDraw mode information DDSURFACEDESC2 ddsdFullscreenMode; BOOL bWindowed; BOOL bStereo; // For internal use (Applications shouldn't need these members.) GUID guidDevice; GUID guidDriver; DDSURFACEDESC2* pddsdModes; DWORD dwNumModes; DWORD dwCurrentMode; BOOL bDesktopCompatible; BOOL bStereoCompatible; }; |
We'll be filling up this structure with the information we determine about the system hardware capabilities by using the routines covered in this chapter.