From f3f74f668adda4ff01a6baae9653357426b13555 Mon Sep 17 00:00:00 2001 From: tuxmain Date: Sat, 27 Aug 2022 09:34:21 +0200 Subject: [PATCH] Warn wasm users about audio not working --- README.md | 1 - src/menu.rs | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ca17f04..b53f02d 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ * more audio * "jumpable" component to avoid jumping on sensors * bug: in level2, move the blue character to win, then reset. The characters are lighter than expected. (also level 4) -* wasm warning * redshift warning * itchio test diff --git a/src/menu.rs b/src/menu.rs index fff9778..f35f024 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -20,6 +20,22 @@ impl Plugin for MenuPlugin { fn setup(mut commands: Commands, asset_server: Res) { let font = asset_server.get_handle("UacariLegacy-Thin.ttf"); + #[cfg(target_arch = "wasm32")] + commands + .spawn_bundle(Text2dBundle { + text: Text::from_section( + "Note:\nAudio is NOT available in the WASM build.", + TextStyle { + font: font.clone(), + font_size: 24.0, + color: Color::rgba(1., 0.4, 0.4, 1.), + }, + ) + .with_alignment(TextAlignment::CENTER), + transform: Transform::from_xyz(0., -128.0, 0.), + ..Default::default() + }) + .insert(Menu); commands .spawn_bundle(Text2dBundle { text: Text::from_section(