MCPcopy Create free account
hub / github.com/angular-rust/ux-components / run

Method run

src/foundation/material_application.rs:68–459  ·  view source on GitHub ↗
(mut context: D::Context, settings: ApplicationSettings)

Source from the content-addressed store, hash-verified

66
67impl 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);

Callers

nothing calls this directly

Calls 15

initFunction · 0.85
buildMethod · 0.80
setMethod · 0.80
create_stateMethod · 0.80
nextMethod · 0.80
before_eventMethod · 0.80
resizedMethod · 0.80
movedMethod · 0.80
dropped_fileMethod · 0.80
hovered_fileMethod · 0.80
received_characterMethod · 0.80

Tested by

no test coverage detected