как правильно восстановить ID3DXSprite
От: Titanus Россия  
Дата: 04.02.06 10:49
Оценка:
как правильно восстановить ID3DXSprite?
Вот мой код, но он не работает

HRESULT D3DSprite8::Restore(HWND hWnd)
{
    if(lpD3DDevice == 0 || lpD3DSprite == 0) return D3DERR_NOTFOUND;
    HRESULT result = lpD3DDevice->TestCooperativeLevel();
    if(result == D3DERR_DEVICELOST) lpD3DSprite->OnLostDevice();
    if(result == D3DERR_DEVICENOTRESET) 
    {
        result = lpD3DDevice->Reset(&d3dpp);
        if(result != D3D_OK) return result;
        result = lpD3DSprite->OnResetDevice();
        if(result != D3D_OK) return result;
    }
    return result;
}



И еще один вопрос по ID3DXSprite: как поменять разрешение экрана
Я делаю так, но не работает

HRESULT D3DSprite8::ResetDisplayMode(UINT width, UINT height, UINT frequency, bool FullScreen)
{
    ZeroMemory(&d3dpp,sizeof(d3dpp));
    d3dpp.Windowed = !FullScreen;
    d3dpp.BackBufferCount = 1;
    d3dpp.BackBufferWidth = width;
    d3dpp.BackBufferHeight = height;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    if(FullScreen) d3dpp.FullScreen_RefreshRateInHz = frequency;
    if(lpD3DDevice == 0) return D3DERR_NOTFOUND;
    HRESULT result = lpD3DDevice->Reset(&d3dpp);
    if(result != D3D_OK) return result;
    result = lpD3DSprite->OnResetDevice();
    return result;
}
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.