Example #1
0
//--------------------------------------------------------------------------------------
// This callback function will be called immediately after the Direct3D device has 
// been destroyed, which generally happens as a result of application termination or 
// windowed/full screen toggles. Resources created in the OnCreateDevice callback 
// should be released here, which generally includes all D3DPOOL_MANAGED resources. 
//--------------------------------------------------------------------------------------
void CALLBACK OnDestroyDevice( void* pUserContext )
{
    g_DialogResourceManager.OnD3D9DestroyDevice();
    g_SettingsDlg.OnD3D9DestroyDevice();
    SAFE_RELEASE( g_pEffect );
    SAFE_RELEASE( g_pFont );

    g_LightControl.StaticOnD3D9DestroyDevice();
    g_Skybox.OnDestroyDevice();

    if( g_pFrameRoot )
    {
        CAllocateHierarchy Alloc;
        D3DXFrameDestroy( g_pFrameRoot, &Alloc );
        g_pFrameRoot = NULL;
    }

    SAFE_RELEASE( g_pAnimController );
}