()
| 232 | } |
| 233 | |
| 234 | fn main() { |
| 235 | let mut args = std::env::args_os(); |
| 236 | let maybe_path = args.nth(1).map(PathBuf::from); |
| 237 | |
| 238 | let scene = if let Some(path) = maybe_path { |
| 239 | let file = std::fs::File::open(&path).expect("File not found"); |
| 240 | let archive = SceneArchive::deserialize(file).expect("Failed to deserialize archive"); |
| 241 | archive |
| 242 | .to_scene() |
| 243 | .expect("Failed to convert archive to scene") |
| 244 | } else { |
| 245 | default_scene() |
| 246 | }; |
| 247 | |
| 248 | let mut app = App { |
| 249 | render_state: RenderState::Suspended(None), |
| 250 | scene, |
| 251 | width: 800, |
| 252 | height: 600, |
| 253 | }; |
| 254 | |
| 255 | let event_loop = EventLoop::new().unwrap(); |
| 256 | event_loop |
| 257 | .run_app(&mut app) |
| 258 | .expect("Couldn't run event loop"); |
| 259 | } |
| 260 | |
| 261 | fn default_scene() -> Scene { |
| 262 | let mut scene = Scene::new(); |
nothing calls this directly
no test coverage detected