(mut context: D::Context, settings: ApplicationSettings)
| 66 | |
| 67 | impl MaterialApplication { |
| 68 | pub fn run<D>(mut context: D::Context, settings: ApplicationSettings) |
| 69 | where |
| 70 | D: StatefulWidget<Out = D> + Context + Default + 'static, |
| 71 | // D: SceneActivity<Self> + WidgetBuilder + Context + 'static, |
| 72 | { |
| 73 | log::info!("starting async \"{}\"", settings.title); |
| 74 | |
| 75 | // get CLI options |
| 76 | let opt = Opt::from_args(); |
| 77 | let width = opt.width.unwrap_or(settings.width); |
| 78 | let height = opt.height.unwrap_or(settings.height); |
| 79 | let fullscreen = opt.fullscreen.unwrap_or(settings.fullscreen); |
| 80 | |
| 81 | // // build the WindowDim |
| 82 | // let win_dim = if fullscreen { |
| 83 | // if opt.width.is_some() && opt.height.is_some() { |
| 84 | // log::info!("window mode: fullscreen restricted ({}×{})", width, height); |
| 85 | // WindowDim::FullscreenRestricted(width, height) |
| 86 | // } else { |
| 87 | // log::info!("window mode: fullscreen"); |
| 88 | // WindowDim::Fullscreen |
| 89 | // } |
| 90 | // } else { |
| 91 | // log::info!("window mode: windowed ({}×{})", width, height); |
| 92 | // WindowDim::Windowed(width, height) |
| 93 | // }; |
| 94 | |
| 95 | // let win_opt = WindowOpt::default(); |
| 96 | |
| 97 | let event_loop = EventLoop::new(); |
| 98 | let window = WindowBuilder::new() |
| 99 | .with_min_inner_size(Size::Logical(LogicalSize::new(64.0, 64.0))) |
| 100 | .with_inner_size(Size::Physical(PhysicalSize::new(width, height))) |
| 101 | .with_title(settings.title) |
| 102 | .build(&event_loop) |
| 103 | .unwrap(); |
| 104 | |
| 105 | // initialize and configure |
| 106 | let instance = Instance::new(); |
| 107 | let surface = instance.create_surface(&window); |
| 108 | let adapter = instance.request_adapter(); |
| 109 | let (device, _) = adapter.request_device(); |
| 110 | let desc = SurfaceConfiguration { |
| 111 | usage: TextureUsages::RENDER_ATTACHMENT, |
| 112 | format: TextureFormat::Bgra8UnormSrgb, |
| 113 | width, |
| 114 | height, |
| 115 | present_mode: PresentMode::Fifo, |
| 116 | }; |
| 117 | let swapchain = device.create_swap_chain(&surface, &desc); |
| 118 | |
| 119 | // create the store |
| 120 | let store_opt = StoreOpt::default().set_root("assets"); |
| 121 | let mut store: Store<D::Context, StoreKey> = Store::new(store_opt) |
| 122 | .map_err(|e| error::Error::cannot_create_store(format!("{}", e))) |
| 123 | .unwrap(); |
| 124 | |
| 125 | let window = Arc::new(window); |
nothing calls this directly
no test coverage detected