Add music to emscripten port. emscripten
authorBernie Innocenti <bernie@codewiz.org>
Sat, 22 Apr 2017 23:40:33 +0000 (19:40 -0400)
committerBernie Innocenti <bernie@codewiz.org>
Sat, 22 Apr 2017 23:40:33 +0000 (19:40 -0400)
Cargo.toml
debug.sh
main.rs
release.sh
release_wasm.sh
sound_emscripten.rs [deleted file]

index 44b8aec0fc409f28c1148d49fb714fbab99fb2a9..2ca01347ff091b7956603a789cd66ab0861916d7 100644 (file)
@@ -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]
index 27121aa7e1d4e7576c0d7de40614f989a7d9e70a..3c2d514aeaf624119778b1164dd4a3bd3c62dd39 100755 (executable)
--- 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 c63add0e4dd33c68cc829cb8b5d52aa39583f2fe..2632712ce8083dc979e662ece34516738b81bd19 100644 (file)
--- 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;
 
index 171d4f945b4d9444f1c0e91afbcf8e488b6c72dc..262849a9c950a835c0c24dabbd8255996534f32c 100755 (executable)
@@ -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 .
index f09f62349e84d1aa2bfc5519abfd6a2952932d91..df96bcf93d08716a68ad562d4227229d20c48ece 100755 (executable)
@@ -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 (file)
index 2b3d2a3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-pub struct SoundPlayer {}
-
-pub fn start() -> SoundPlayer { SoundPlayer {} }