Using the Mouse Device

All of the DirectInput devices use this same device class, so the differences between using the mouse and keyboard are quite simple. You will need to update the device creation method in InitializeInput() to use a mouse GUID rather than the keyboard:

device = new Device(SystemGuid.Mouse);

ACQUIRING THE MOUSE EXCLUSIVELY

Acquiring the mouse in exclusive mode on certain operating systems will hide the mouse cursor completely. While this behavior is sometimes desired, in many instances it is not. For example, if you are writing a menu system for your game that is in full screen mode, the user will expect to be able to use that menu via the mouse. Many times you will need to provide your own cursors in this case.

In order ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.