| 214 | } |
| 215 | |
| 216 | void VulkanApp::mainLoop() |
| 217 | { |
| 218 | double timeStamp = glfwGetTime(); |
| 219 | float deltaSeconds = 0.0f; |
| 220 | |
| 221 | do |
| 222 | { |
| 223 | update(deltaSeconds); |
| 224 | |
| 225 | const double newTimeStamp = glfwGetTime(); |
| 226 | deltaSeconds = static_cast<float>(newTimeStamp - timeStamp); |
| 227 | timeStamp = newTimeStamp; |
| 228 | |
| 229 | fpsCounter_.tick(deltaSeconds); |
| 230 | |
| 231 | bool frameRendered = drawFrame(ctx_.vkDev, |
| 232 | [this](uint32_t img) { this->updateBuffers(img); }, |
| 233 | [this](auto cmd, auto img) { ctx_.composeFrame(cmd, img); } |
| 234 | ); |
| 235 | |
| 236 | fpsCounter_.tick(deltaSeconds, frameRendered); |
| 237 | |
| 238 | glfwPollEvents(); |
| 239 | |
| 240 | } while (!glfwWindowShouldClose(window_)); |
| 241 | } |
| 242 | |
| 243 | void CameraApp::handleKey(int key, bool pressed) |
| 244 | { |