From: Bernie Innocenti Date: Sat, 22 Apr 2017 23:40:33 +0000 (-0400) Subject: Add music to emscripten port. X-Git-Tag: v0.6.0~7 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Femscripten;p=mandelwow.git Add music to emscripten port. --- diff --git a/Cargo.toml b/Cargo.toml index 44b8aec..2ca0134 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,15 +15,14 @@ glutin = "0.7.4" genmesh = "0.4.1" image = "0.12.0" obj = { version = "0.5", features = ["usegenmesh"] } - -[target.'cfg(not(target_os = "emscripten"))'.dependencies] libxm = "1.0.0" sdl2 = "*" + +[target.'cfg(not(target_os = "emscripten"))'.dependencies] backtrace = "0.2.2" backtrace-sys = "0.1.10" [target.'cfg(target_os = "emscripten")'.dependencies] -glutin = "0.6.1" backtrace = "0.2.3" [replace] diff --git a/debug.sh b/debug.sh index 27121aa..3c2d514 100755 --- a/debug.sh +++ b/debug.sh @@ -1,4 +1,5 @@ set -e -cargo build --target asmjs-unknown-emscripten +cargo rustc --target asmjs-unknown-emscripten -- -C link-args='-s USE_SDL=2 --preload-file flora.xm' cp target/asmjs-unknown-emscripten/debug/mandelwow.js . +cp target/asmjs-unknown-emscripten/debug/deps/mandelwow-ec0c575eb8c2718a.data . emrun . diff --git a/main.rs b/main.rs index c63add0..2632712 100644 --- a/main.rs +++ b/main.rs @@ -3,9 +3,7 @@ extern crate cgmath; extern crate glium; extern crate glutin; extern crate image; -#[cfg(not(target_os = "emscripten"))] extern crate libxm; -#[cfg(not(target_os = "emscripten"))] extern crate sdl2; //use cgmath::prelude::*; @@ -20,10 +18,6 @@ use std::os::raw::{c_int, c_void}; mod bounding_box; mod cube; mod mandelwow; -#[cfg(not(target_os = "emscripten"))] -mod sound; -#[cfg(target_os = "emscripten")] -#[path = "sound_emscripten.rs"] mod sound; mod support; diff --git a/release.sh b/release.sh index 171d4f9..262849a 100755 --- a/release.sh +++ b/release.sh @@ -1,4 +1,4 @@ set -e -cargo build --target asmjs-unknown-emscripten --release +cargo rustc --target asmjs-unknown-emscripten --release -- -C link-args='-s USE_SDL=2' cp target/asmjs-unknown-emscripten/release/mandelwow.js . emrun . diff --git a/release_wasm.sh b/release_wasm.sh index f09f623..df96bcf 100755 --- a/release_wasm.sh +++ b/release_wasm.sh @@ -1,5 +1,5 @@ set -e -cargo build --target wasm32-unknown-emscripten --release +cargo rustc --target wasm32-unknown-emscripten --release -- -C link-args='-s USE_SDL=2 --preload-file flora.xm' cp target/wasm32-unknown-emscripten/release/mandelwow.js . -cp target/wasm32-unknown-emscripten/release/deps/mandelwow-*.wasm . +cp target/wasm32-unknown-emscripten/release/deps/mandelwow-*.{wasm,data} . emrun . diff --git a/sound_emscripten.rs b/sound_emscripten.rs deleted file mode 100644 index 2b3d2a3..0000000 --- a/sound_emscripten.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub struct SoundPlayer {} - -pub fn start() -> SoundPlayer { SoundPlayer {} }