| 452 | } |
| 453 | |
| 454 | bool Platform::start_app() |
| 455 | { |
| 456 | auto *requested_app_info = requested_app; |
| 457 | // Reset early incase error in preparation stage |
| 458 | requested_app = nullptr; |
| 459 | |
| 460 | if (active_app) |
| 461 | { |
| 462 | auto execution_time = timer.stop(); |
| 463 | LOGI("Closing App (Runtime: {:.1f})", execution_time); |
| 464 | |
| 465 | auto app_id = active_app->get_name(); |
| 466 | |
| 467 | active_app->finish(); |
| 468 | } |
| 469 | |
| 470 | active_app = requested_app_info->create(); |
| 471 | |
| 472 | if (!active_app) |
| 473 | { |
| 474 | LOGE("Failed to create a valid vulkan app."); |
| 475 | return false; |
| 476 | } |
| 477 | auto sample_info = static_cast<const apps::SampleInfo *>(requested_app_info); |
| 478 | active_app->set_name(sample_info->name); |
| 479 | |
| 480 | if (!active_app->prepare({fixed_simulation_fps, window.get()})) |
| 481 | { |
| 482 | LOGE("Failed to prepare vulkan app."); |
| 483 | return false; |
| 484 | } |
| 485 | |
| 486 | on_app_start(requested_app_info->id); |
| 487 | |
| 488 | return true; |
| 489 | } |
| 490 | |
| 491 | void Platform::input_event(const InputEvent &input_event) |
| 492 | { |