| 1275 | } |
| 1276 | |
| 1277 | void SceneController::drawUI() |
| 1278 | { |
| 1279 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 1280 | // Scene UI |
| 1281 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 1282 | |
| 1283 | m_scene->drawUI(); |
| 1284 | |
| 1285 | |
| 1286 | ImGui::Spacing(); |
| 1287 | ImGui::Spacing(); |
| 1288 | ImGui::Separator(); |
| 1289 | ImGui::Spacing(); |
| 1290 | ImGui::Spacing(); |
| 1291 | |
| 1292 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 1293 | // Replay |
| 1294 | /////////////////////////////////////////////////////////////////////////////////////////// |
| 1295 | { |
| 1296 | ImGui::Text("Replay Control:"); |
| 1297 | |
| 1298 | BlastReplay* replay = getBlastController().getReplay(); |
| 1299 | if (replay->isRecording()) |
| 1300 | { |
| 1301 | auto getAnimStr = []() |
| 1302 | { |
| 1303 | const uint32_t count = 5; |
| 1304 | const uint64_t periodMS = 150; |
| 1305 | static char str[count + 1] = ""; |
| 1306 | for (uint32_t i = 0; i < count; i++) |
| 1307 | { |
| 1308 | uint64_t ts = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count(); |
| 1309 | str[i] = (i == (ts % (periodMS * count)) / periodMS) ? '*' : ' '; |
| 1310 | } |
| 1311 | return str; |
| 1312 | }; |
| 1313 | ImGui::Text("State: Recording [%s] | Events: %d", getAnimStr(), replay->getEventCount()); |
| 1314 | |
| 1315 | if (ImGui::Button("Stop Recording")) |
| 1316 | { |
| 1317 | replay->stopRecording(); |
| 1318 | } |
| 1319 | } |
| 1320 | else if (replay->isPlaying()) |
| 1321 | { |
| 1322 | ImGui::Text("State: Playing | Events: %d / %d", replay->getCurrentEventIndex(), replay->getEventCount()); |
| 1323 | |
| 1324 | if (ImGui::Button("Stop Playing")) |
| 1325 | { |
| 1326 | replay->stopPlayback(); |
| 1327 | } |
| 1328 | } |
| 1329 | else |
| 1330 | { |
| 1331 | ImGui::Text("State: Idle | Events: %d", replay->getEventCount()); |
| 1332 | |
| 1333 | static bool syncFamilies = true; |
| 1334 | static bool syncPhysics = true; |
no test coverage detected