Function run Copy item path Source pub fn run<G: Game >(
config: Config ,
init: impl FnOnce (&mut InitContext <'_, G>) -> Result <G, Error > + Send + 'static,
)Expand description Opens the window and runs the game init builds until it is closed.
init runs once the GPU exists; returning Err aborts startup.
Blocks on the desktop; passes control to the browser’s event loop and returns
there. Errors that stop startup are reported to the standard error
stream, or to the console and a page overlay in the browser.
530 fn main() {
531 run (
532 Config::new("Mirage: every control as an action" ),
533 InputLab::init,
534 );
535 }More examples Hide additional examples
103 fn main() {
104 run (
105 Config::new("Mirage: stress preview" ).with_size(1280 , 720 ),
106 StressPreview::init,
107 );
108 }168 fn main() {
169 run (
170 Config::new("Mirage: screen effects" ).with_size(1280 , 720 ),
171 PostEffectEffects::init,
172 );
173 }113 fn main() {
114 run (
115 Config::new("Mirage: sound lab" )
116 .with_size(1280 , 720 )
117 .with_assets(ASSET_FILES),
118 SoundCheck::init,
119 );
120 }756 fn main() {
757 run (
758 Config::new("Mirage: flock parallelism" )
759 .with_size(1280 , 720 )
760 .with_assets([BUTTERFLY_SOURCE]),
761 Flock::init,
762 );
763 }157 fn main() {
158 run (
159 Config::new("Mirage: breakout game" )
160 .with_size(1280 , 720 )
161 .with_assets([MODEL].into_iter().chain(SOUNDS)),
162 Breakout::init,
163 );
164 }Additional examples can be found in: