Overview

DirectInput is a COM library this is part of DirectX.

<aside> 🌐 The last version is DirectInput 8.

</aside>

DirectInput is primarily designed to process input data from joysticks.

<aside> ⚠️ DirectInput can be used for keyboard and mouse but it is not recommended.

</aside>

DirectInput has been superseded by XInput but has some advantages:

However, DirectInput does not handle the Xbox 360 and Xbox One controllers as well as XInput.

API

The root object of the library is used to enumerate and create the input devices.

An input device is a keyboard, mouse, joystick, or a game controller.

<aside> 💡 Both joysticks and game controllers are known as joysticks in DirectInput.

</aside>

Input devices are associated with a unique identifier (GUID).

The keyboard and mouse have a fixed GUID in the API, but the GUID for joysticks and game controllers is retrieved by enumerating the devices on the system.

Each input device has device objects, which represent keys, buttons, or axes.

Initialization

  1. Set up DirectInput