j essaie de mettre en place une fonction de reset pour pouvoir changer la resolution en cours de jeu et Device->Reset me renvoie D3DERR_INVALIDCALL pourtant j ai verifier tout les parametres et la structure EngineConfig et les valeurs sont bonnes
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 void D3DManager::Reset() { try { D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.BackBufferWidth = this->EngineConfig.ScreenWidth; d3dpp.BackBufferHeight = this->EngineConfig.ScreenHeight; d3dpp.EnableAutoDepthStencil = false; d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8; d3dpp.SwapEffect = D3DSWAPEFFECT_FLIP; d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; /*if (this->EngineConfig.PleinEcran == true) { d3dpp.Windowed = FALSE; d3dpp.FullScreen_RefreshRateInHz = this->EngineConfig.FrequenceEcran; } else {*/ d3dpp.Windowed = TRUE; d3dpp.FullScreen_RefreshRateInHz = 0; //} HRESULT ret = this->Device->Reset(&d3dpp); if (ret != D3D_OK) { switch(ret) { case D3DERR_DEVICELOST: throw EngineException("D3DERR_DEVICELOST"); case D3DERR_DRIVERINTERNALERROR: throw EngineException("D3DERR_DRIVERINTERNALERROR"); case D3DERR_INVALIDCALL: throw EngineException("D3DERR_INVALIDCALL"); case D3DERR_OUTOFVIDEOMEMORY: throw EngineException("D3DERR_OUTOFVIDEOMEMORY"); case E_OUTOFMEMORY: throw EngineException("E_OUTOFMEMORY"); }; } this->SetDeviceStat(); this->InitialisationMatrice(); this->CreateVertexBuffer(); int iLeft = (GetDeviceCaps(GetDC(NULL), HORZRES) - this->EngineConfig.ScreenWidth) / 2; int iTop = (GetDeviceCaps(GetDC(NULL), VERTRES) - this->EngineConfig.ScreenHeight) / 2; SetWindowPos(this->hwnd,HWND_TOPMOST,iLeft,iTop,this->EngineConfig.ScreenWidth,this->EngineConfig.ScreenHeight,SWP_SHOWWINDOW); ShowWindow(this->hwnd, SW_NORMAL); } catch (EngineException& er) { this->log << "Exception au reset: \n" << er.What() << std::endl << this->EngineConfig.ScreenWidth << std::endl << this->EngineConfig.ScreenHeight << std::endl << this->EngineConfig.FrequenceEcran << std::endl << this->EngineConfig.PleinEcran << std::endl; } catch (...) { this->log << "Eception inconnue est lance dans reset\n"; } }
Partager