| 9 | namespace TEN::Renderer |
| 10 | { |
| 11 | void Renderer::ChangeScreenResolution(int width, int height, bool windowed) |
| 12 | { |
| 13 | ID3D11RenderTargetView* nullViews[] = { nullptr }; |
| 14 | _context->OMSetRenderTargets(0, nullViews, NULL); |
| 15 | _context->Flush(); |
| 16 | _context->ClearState(); |
| 17 | |
| 18 | IDXGIOutput* output; |
| 19 | Utils::throwIfFailed(_swapChain->GetContainingOutput(&output)); |
| 20 | |
| 21 | DXGI_SWAP_CHAIN_DESC scd; |
| 22 | Utils::throwIfFailed(_swapChain->GetDesc(&scd)); |
| 23 | |
| 24 | unsigned int numModes = 1024; |
| 25 | DXGI_MODE_DESC modes[1024]; |
| 26 | Utils::throwIfFailed(output->GetDisplayModeList(scd.BufferDesc.Format, 0, &numModes, modes)); |
| 27 | |
| 28 | DXGI_MODE_DESC* mode = &modes[0]; |
| 29 | for (unsigned int i = 0; i < numModes; i++) |
| 30 | { |
| 31 | mode = &modes[i]; |
| 32 | if (mode->Width == width && mode->Height == height) |
| 33 | break; |
| 34 | } |
| 35 | |
| 36 | Utils::throwIfFailed( _swapChain->ResizeTarget(mode)); |
| 37 | |
| 38 | _screenWidth = width; |
| 39 | _screenHeight = height; |
| 40 | _isWindowed = windowed; |
| 41 | |
| 42 | InitializeScreen(width, height, WindowsHandle, true); |
| 43 | } |
| 44 | |
| 45 | std::string Renderer::GetDefaultAdapterName() |
| 46 | { |
no test coverage detected