Microsoft DirectX 8.0 (C++) |
This application-defined sample function deallocates existing Microsoft® DirectInput® interface pointers in preparation for program shutdown or in the event of a failure to properly initialize a device.
/* The following variables are presumed initialized: LPDIRECTINPUT8 g_lpDI; LPDIRECTINPUTDEVICE8 g_lpDIDevice; */ void WINAPI DI_Term() { if (g_lpDI) { if (g_lpDIDevice) { // Always unacquire device before calling Release(). g_lpDIDevice->Unacquire(); g_lpDIDevice->Release(); g_lpDIDevice = NULL; } g_lpDI->Release(); g_lpDI = NULL; } }
For additional DirectInput tutorials, see DirectInput C/C++ Tutorials.