forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement WASM support for bevy_winit (bevyengine#503)
Also, replaced wasm_timer::Instant with instant::Instant as it is used by winit WASM implementation.
- Loading branch information
Showing
11 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
extern crate console_error_panic_hook; | ||
use bevy::prelude::*; | ||
use std::panic; | ||
|
||
fn main() { | ||
panic::set_hook(Box::new(console_error_panic_hook::hook)); | ||
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log"); | ||
|
||
App::build() | ||
.add_default_plugins() | ||
.add_startup_system(hello_wasm_system.system()) | ||
.add_system(counter.system()) | ||
.run(); | ||
} | ||
|
||
fn hello_wasm_system() { | ||
log::info!("hello wasm"); | ||
} | ||
|
||
fn counter(mut state: Local<CounterState>, time: Res<Time>) { | ||
if state.count % 60 == 0 { | ||
log::info!( | ||
"tick {} @ {:?} [Δ{}]", | ||
state.count, | ||
time.time_since_startup(), | ||
time.delta_seconds | ||
); | ||
} | ||
state.count += 1; | ||
} | ||
|
||
#[derive(Default)] | ||
struct CounterState { | ||
count: u32, | ||
} |