| 201 | #endif |
| 202 | |
| 203 | void ExampleBase::Run() |
| 204 | { |
| 205 | LLGL::Extent2D resolution = context->GetResolution(); |
| 206 | bool showTimeRecords = false; |
| 207 | |
| 208 | while (context->GetSurface().ProcessEvents() && !input->KeyDown(LLGL::Key::Escape)) |
| 209 | { |
| 210 | // Update profiler (if debugging is enabled) |
| 211 | if (debuggerObj_) |
| 212 | { |
| 213 | if (showTimeRecords) |
| 214 | { |
| 215 | std::cout << "\n"; |
| 216 | std::cout << "FRAME TIME RECORDS:\n"; |
| 217 | std::cout << "-------------------\n"; |
| 218 | for (const auto& rec : profilerObj_->frameProfile.timeRecords) |
| 219 | std::cout << rec.annotation << ": " << rec.elapsedTime << " ns\n"; |
| 220 | |
| 221 | profilerObj_->timeRecordingEnabled = false; |
| 222 | showTimeRecords = false; |
| 223 | } |
| 224 | else if (input->KeyDown(LLGL::Key::F1)) |
| 225 | { |
| 226 | profilerObj_->timeRecordingEnabled = true; |
| 227 | showTimeRecords = true; |
| 228 | } |
| 229 | profilerObj_->NextProfile(); |
| 230 | } |
| 231 | |
| 232 | // Draw current frame |
| 233 | #ifdef LLGL_OS_MACOS |
| 234 | @autoreleasepool |
| 235 | { |
| 236 | OnDrawFrame(); |
| 237 | } |
| 238 | #else |
| 239 | OnDrawFrame(); |
| 240 | #endif |
| 241 | |
| 242 | // Check if resolution has changed |
| 243 | auto currentResolution = context->GetResolution(); |
| 244 | if (resolution != currentResolution) |
| 245 | { |
| 246 | OnResize(currentResolution); |
| 247 | resolution = currentResolution; |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | ExampleBase::ExampleBase( |
| 253 | const std::wstring& title, |
no test coverage detected