Microsoft DirectX 9.0

Step 4: Configuring and Applying the Action Map

Once the mapping has been returned in the DIACTIONFORMAT structure, it can be manipulated before being applied by IDirectInputDevice8::SetActionMap.

The dwHow member of each DIACTIONFORMAT structure might be examined at this point to determine both whether the mapping was successful and what the criteria were in selecting the device object to which that action was mapped. For instance, you can determine if the mapping was specified by the hardware manufacturer or requested by the user.

The actual mapping itself may be changed as well by editing the dwSemantic member of the appropriate DIACTIONFORMAT structure returned in the default mapping. You can choose to make those changes, but it is not recommended that you do so.

Once the action map configuration is finalized, it must be applied to the device to bind the physical controls to the game actions. This is done by calling IDirectInputDevice8::SetActionMap as follows:

    hr = pdidDevice->SetActionMap( &m_diaf, m_strUserName, 0L );

Action maps, once created, can be displayed for and easily altered by the user. This is explained in Step 5: Displaying the Action Map.

© 2002 Microsoft Corporation. All rights reserved.