| 44 | } |
| 45 | |
| 46 | int Application::run() |
| 47 | { |
| 48 | // FirstPersonCamera uses this timer, without it it will be FPS-dependent |
| 49 | DXUTGetGlobalTimer()->Start(); |
| 50 | |
| 51 | for (auto it = m_controllers.begin(); it != m_controllers.end(); it++) |
| 52 | m_deviceManager->AddControllerToFront(*it); |
| 53 | |
| 54 | DeviceCreationParameters deviceParams; |
| 55 | deviceParams.swapChainFormat = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; |
| 56 | deviceParams.swapChainSampleCount = 4; |
| 57 | deviceParams.startFullscreen = false; |
| 58 | deviceParams.backBufferWidth = 1600; |
| 59 | deviceParams.backBufferHeight = 900; |
| 60 | #if defined(DEBUG) | defined(_DEBUG) |
| 61 | deviceParams.createDeviceFlags = D3D11_CREATE_DEVICE_DEBUG; |
| 62 | #endif |
| 63 | deviceParams.featureLevel = D3D_FEATURE_LEVEL_11_0; |
| 64 | |
| 65 | if (FAILED(m_deviceManager->CreateWindowDeviceAndSwapChain(deviceParams, m_sampleName.c_str()))) |
| 66 | { |
| 67 | MessageBoxA(nullptr, "Cannot initialize the D3D11 device with the requested parameters", "Error", |
| 68 | MB_OK | MB_ICONERROR); |
| 69 | return 1; |
| 70 | } |
| 71 | |
| 72 | for (auto it = m_controllers.begin(); it != m_controllers.end(); it++) |
| 73 | (*it)->onInitialize(); |
| 74 | |
| 75 | for (auto it = m_controllers.begin(); it != m_controllers.end(); it++) |
| 76 | (*it)->onSampleStart(); |
| 77 | |
| 78 | m_deviceManager->SetVsyncEnabled(false); |
| 79 | m_deviceManager->MessageLoop(); |
| 80 | |
| 81 | for (auto it = m_controllers.rbegin(); it != m_controllers.rend(); it++) |
| 82 | (*it)->onSampleStop(); |
| 83 | |
| 84 | for (auto it = m_controllers.rbegin(); it != m_controllers.rend(); it++) |
| 85 | (*it)->onTerminate(); |
| 86 | |
| 87 | m_deviceManager->Shutdown(); |
| 88 | delete m_deviceManager; |
| 89 | |
| 90 | return 0; |
| 91 | } |
nothing calls this directly
no test coverage detected