| 189 | } |
| 190 | |
| 191 | ExitCode Platform::main_loop_frame() |
| 192 | { |
| 193 | try |
| 194 | { |
| 195 | // Load the requested app |
| 196 | if (app_requested()) |
| 197 | { |
| 198 | if (!start_app()) |
| 199 | { |
| 200 | throw std::runtime_error("Failed to load requested application"); |
| 201 | } |
| 202 | |
| 203 | // Compensate for load times of the app by rendering the first frame pre-emptively |
| 204 | timer.tick<Timer::Seconds>(); |
| 205 | active_app->update(0.01667f); |
| 206 | } |
| 207 | |
| 208 | if (!active_app) |
| 209 | { |
| 210 | return ExitCode::NoSample; |
| 211 | } |
| 212 | |
| 213 | update(); |
| 214 | |
| 215 | if (active_app->should_close()) |
| 216 | { |
| 217 | std::string id = active_app->get_name(); |
| 218 | on_app_close(id); |
| 219 | active_app->finish(); |
| 220 | } |
| 221 | |
| 222 | window->process_events(); |
| 223 | |
| 224 | if (window->should_close() || close_requested) |
| 225 | { |
| 226 | return ExitCode::Close; |
| 227 | } |
| 228 | } |
| 229 | catch (std::exception &e) |
| 230 | { |
| 231 | LOGE("Error Message: {}", e.what()); |
| 232 | LOGE("Failed when running application {}", active_app->get_name()); |
| 233 | |
| 234 | on_app_error(active_app->get_name()); |
| 235 | |
| 236 | if (app_requested()) |
| 237 | { |
| 238 | LOGI("Attempting to load next application"); |
| 239 | } |
| 240 | else |
| 241 | { |
| 242 | set_last_error(e.what()); |
| 243 | return ExitCode::FatalError; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | return ExitCode::Success; |
| 248 | } |
nothing calls this directly
no test coverage detected