So far we have been using Direct3D to draw 3D objects. Now we want to add some user interaction to our application. We can do this by using DirectInput. DirectInput allows us to get data from any input device: mouse, keyboard or joystick. We can then use this data to change elements in our scene. In this tutorial we will be looking at the mouse and keyboard only, we'll take a look at joysticks in a future tutorial.
In our application, we will need to do the following steps to add user interaction.
· Initialise DirectInput
· Setup the keyboard
· Setup the mouse
· For each frame, get the state of the keyboard and mouse and use it to modify the scene
· Once finished, clean up DirectInput