MCPcopy Create free account
hub / github.com/DioxusLabs/anyrender / main

Function main

examples/player/src/main.rs:234–259  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

232}
233
234fn 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
261fn default_scene() -> Scene {
262 let mut scene = Scene::new();

Callers

nothing calls this directly

Calls 3

deserializeFunction · 0.85
default_sceneFunction · 0.85
to_sceneMethod · 0.80

Tested by

no test coverage detected