Skip to content

Commit

Permalink
chore: update WASM config
Browse files Browse the repository at this point in the history
  • Loading branch information
carrascomj committed Jan 2, 2025
1 parent d7f88c6 commit ac0de95
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ rustflags = ["-Zshare-generics=n"]

[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"
rustflags = ["--cfg=web_sys_unstable_apis"]

# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
Expand Down
27 changes: 17 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fn main() {
/// - Insert a Receiver resource so that systems can listen to that.
fn main() {
use async_std::channel::{unbounded, Receiver, Sender};
use bevy::asset::AssetMetaCheck;
use gui::ReceiverResource;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::{spawn_local, JsFuture};
Expand Down Expand Up @@ -160,20 +161,26 @@ fn main() {
target_data.set_onchange(Some(data_closure.as_ref().unchecked_ref()));

App::new()
.insert_resource(Msaa::Sample4)
.insert_resource(WinitSettings::desktop_app())
.insert_resource(ReceiverResource { rx: map_receiver })
.insert_resource(ReceiverResource { rx: data_receiver })
.insert_resource(ReceiverResource { rx: info_receiver })
.add_plugins(DefaultPlugins.set(WindowPlugin {
primary_window: Some(Window {
title: "shu".to_string(),
fit_canvas_to_parent: true,
canvas: Some("#bevy".to_string()),
..default()
}),
..default()
}))
.add_plugins(
DefaultPlugins
.set(WindowPlugin {
primary_window: Some(Window {
title: "shu".to_string(),
canvas: Some("#bevy".to_string()),
fit_canvas_to_parent: true,
..default()
}),
..default()
})
.set(AssetPlugin {
meta_check: AssetMetaCheck::Never,
..default()
}),
)
// plugins from dependencies
.add_plugins((PanCamPlugin, ShapePlugin))
// internal plugins
Expand Down

0 comments on commit ac0de95

Please sign in to comment.