Browse Source

Rename example app to example_wasm

pull/1/head
Emil Ernerfeldt 6 years ago
parent
commit
e1652bef77
  1. 103
      Cargo.lock
  2. 2
      Cargo.toml
  3. 2
      README.md
  4. 7
      build_and_run.sh
  5. 4
      build_wasm.sh
  6. 73
      docs/example_wasm.js
  7. BIN
      docs/example_wasm_bg.wasm
  8. 4
      docs/index.html
  9. 2
      example_wasm/Cargo.toml
  10. 0
      example_wasm/src/app.rs
  11. 0
      example_wasm/src/lib.rs

103
Cargo.lock

@ -73,7 +73,7 @@ name = "backtrace-sys"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -87,6 +87,11 @@ name = "block"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bumpalo"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.3.1"
@ -94,7 +99,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cc"
version = "1.0.30"
version = "1.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -107,7 +112,7 @@ name = "cgl"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -185,11 +190,11 @@ name = "emigui_wasm"
version = "0.1.0"
dependencies = [
"emigui 0.1.0",
"js-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"js-sys 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"web-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"web-sys 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -205,22 +210,22 @@ dependencies = [
]
[[package]]
name = "example"
name = "example_glium"
version = "0.1.0"
dependencies = [
"emigui 0.1.0",
"emigui_wasm 0.1.0",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"glium 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "example_glium"
name = "example_wasm"
version = "0.1.0"
dependencies = [
"emigui 0.1.0",
"glium 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)",
"emigui_wasm 0.1.0",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -278,7 +283,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.6.12"
version = "0.6.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -342,10 +347,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "js-sys"
version = "0.3.15"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"wasm-bindgen 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -368,7 +373,7 @@ name = "libloading"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -425,7 +430,7 @@ version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -437,7 +442,7 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -472,7 +477,7 @@ dependencies = [
[[package]]
name = "ordered-float"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -703,7 +708,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"approx 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"stb_truetype 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -900,54 +905,55 @@ dependencies = [
[[package]]
name = "wasm-bindgen"
version = "0.2.38"
version = "0.2.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"wasm-bindgen-macro 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.38"
version = "0.2.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bumpalo 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.38"
version = "0.2.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro-support 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-macro-support 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.38"
version = "0.2.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-shared 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.38"
version = "0.2.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wasm-bindgen-webidl"
version = "0.2.32"
version = "0.2.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -956,7 +962,7 @@ dependencies = [
"proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-backend 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1016,15 +1022,15 @@ dependencies = [
[[package]]
name = "web-sys"
version = "0.3.15"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"js-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"js-sys 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-webidl 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen-webidl 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1125,8 +1131,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
"checksum bumpalo 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e244c3d946bd68dc2c8996d35363d3a855ff55d59aa1c4b41df8b52334c5e19c"
"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb"
"checksum cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "d01c69d08ff207f231f07196e30f84c70f1c815b04f980f8b7b01ff01f05eb92"
"checksum cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ce8bb087aacff865633f0bd5aeaed910fe2fe55b55f4739527f2e023a2e53d"
"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4"
"checksum cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "55e7ec0b74fe5897894cbc207092c577e87c52f8a59e8ca8d97ef37551f60a49"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
@ -1144,13 +1151,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
"checksum gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0ffaf173cf76c73a73e080366bf556b4776ece104b06961766ff11449f38604"
"checksum gleam 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "f1519ca611d230e1deadbedfb79044b921ac4a961ab8823fef10e37271e2c38e"
"checksum gleam 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d7591624fbbc384a8195791facbd16a5b118d5d2240c508de518b7ccc771fe"
"checksum glium 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f653293041a9972e0f7cb037773018633eb0046b467423a03193c63068580a20"
"checksum glutin 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "535c6eda58adbb227604b2db10a022ffd6339d7ea3e970f338e7d98aeb24fcc3"
"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum js-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "09636f30233c2623a9b4bb05506e224733550e2a13b32ab560dc1744fd5103ca"
"checksum js-sys 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "3970f67ef4a716efeba501dbedcc01b4686301b661798a42b24dc8a59d2c6b01"
"checksum khronos_api 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62237e6d326bd5871cd21469323bf096de81f1618cd82cbaf5d87825335aeb49"
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
"checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1"
@ -1167,7 +1174,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum nom 4.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "22293d25d3f33a8567cc8a1dc20f40c7eeb761ce83d0fcca059858580790cac3"
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
"checksum objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9833ab0efe5361b1e2122a0544a5d3359576911a42cb098c2e59be8650807367"
"checksum ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0015e9e8e28ee20c581cfbfe47c650cedeb9ed0721090e0b7ebb10b9cdbcc2"
"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518"
"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b"
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
@ -1221,18 +1228,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1"
"checksum wasm-bindgen 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)" = "f7148f7446b911dd8e8d490a4fd44bf7fcd6caa21ba2fed9aef7bf34b9a974d4"
"checksum wasm-bindgen-backend 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)" = "07b7b7e0a5c244e02469d7ad0f071dca0a01a7be217db41e4de5e05d4a1ab2ac"
"checksum wasm-bindgen-macro 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)" = "e51818f0ab6cdef85125d2c2f1a89096370286fe229d24de89504617918d76af"
"checksum wasm-bindgen-macro-support 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)" = "4770fd638bed46ce4669cb59aba4657e264839c24c568cc03d772849bfaed7eb"
"checksum wasm-bindgen-shared 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)" = "6f52047198d1887ffd4e508264bffbf92382a97c8b09b74781dbb11ee055ccc5"
"checksum wasm-bindgen-webidl 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "264e2ff77974c11640a2c6a91435f645843d2bd7e12e3ce58ac74209e6d5f76d"
"checksum wasm-bindgen 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "06e36714cc3947a9c80ddc9715edb319e445e5ab0d0b083debec0dd52558580e"
"checksum wasm-bindgen-backend 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "6764493f6eeb3f8632ffd418bf7db6a7e7aca98417c115833e4663976cd60a5e"
"checksum wasm-bindgen-macro 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a473501c40a2a4da83ae7176fead61f10d003554b701071a704dd0667397027a"
"checksum wasm-bindgen-macro-support 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "72e5a249738c6315f65ce5527632e2a3a067cdf1765422d8ac1572dcee14f819"
"checksum wasm-bindgen-shared 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "70f57643dac7decc3b53f0e4ffd027e225b79281648842eb46015e58a2400870"
"checksum wasm-bindgen-webidl 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "ef834a1f96cdc811875c00f20680bf15e038e0d0d458a82772afec5fe31ec7c1"
"checksum wayland-client 0.21.11 (registry+https://github.com/rust-lang/crates.io-index)" = "96041810afa07e7953867d46f8f03c41cbca49ebd1e840eef6abefde8b458b30"
"checksum wayland-commons 0.21.11 (registry+https://github.com/rust-lang/crates.io-index)" = "92af0c5dc724c049e9bd927f8563d9a6abaa94893c5305ef0a6d2805e661f3d3"
"checksum wayland-protocols 0.21.11 (registry+https://github.com/rust-lang/crates.io-index)" = "fd94211387fa8ff50df1e4ff7a5529b5a9aebe68ba88acc48e5b7f5fd98f6eef"
"checksum wayland-scanner 0.21.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3611f231e675e15c2feb7623103e6449edc6f10b0598cafb3e16e590a0561355"
"checksum wayland-sys 0.21.11 (registry+https://github.com/rust-lang/crates.io-index)" = "2a69d729a1747a5bf40ae05b94c7904b64fbf2381e365c046d872ce4a34aa826"
"checksum web-sys 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a9c8ff79e13b74f47f438cd48de2ed808c419cd52ec4780dfc6d1de4a37be19"
"checksum web-sys 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "a8286eada98bf34db48fc89ca53428c529a906bf161c6bae4e022f826323eb38"
"checksum weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26a4c67f132386d965390b8a734d5d10adbcd30eb5cc74bd9229af8b83f10044"
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"

2
Cargo.toml

@ -2,8 +2,8 @@
members = [
"emigui",
"emigui_wasm",
"example",
"example_glium",
"example_wasm",
]
# Optimize for small code size:

2
README.md

@ -25,7 +25,7 @@ Currently two backends have been tested:
The same application code can thus be compiled to either into a native app or a web app.
## Demos
[Emigui feature demo](https://emilk.github.io/emigui/index.html), source: https://github.com/emilk/emigui/blob/master/example/src/app.rs
[Emigui feature demo](https://emilk.github.io/emigui/index.html), source: https://github.com/emilk/emigui/blob/master/example_wasm/src/app.rs
[Hobogo: A small game using Emigui](https://emilk.github.io/hobogo/index.html), source: https://github.com/emilk/hobogo

7
build_and_run.sh

@ -1,6 +1,9 @@
#!/bin/bash
set -eu
./build.sh
./build_wasm.sh
open "docs/index.html"
# TODO: release is only because of this bug: https://github.com/tomaka/glutin/pull/1099
# cargo run --release --bin example_glium

4
build.sh → build_wasm.sh

@ -16,10 +16,10 @@ BUILD=debug
rm -rf docs/*.wasm
echo "Build rust:"
cargo build --target wasm32-unknown-unknown
cargo build -p example_wasm --target wasm32-unknown-unknown
echo "Generate JS bindings for wasm:"
FOLDER_NAME=${PWD##*/}
TARGET_NAME="example.wasm"
TARGET_NAME="example_wasm.wasm"
wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \
--out-dir docs --no-modules --no-typescript

73
docs/example.js → docs/example_wasm.js

@ -1,7 +1,6 @@
(function() {
var wasm;
const __exports = {};
let wasm;
let cachedTextEncoder = new TextEncoder('utf-8');
@ -348,20 +347,20 @@ __exports.__widl_f_performance_Window = function(arg0) {
};
__exports.__wbg_new_00eb63e4d0ee8796 = function(arg0) {
__exports.__wbg_new_a2f07ab237bf3627 = function(arg0) {
return addHeapObject(new Float32Array(getObject(arg0)));
};
__exports.__wbg_subarray_a64203346c9773d6 = function(arg0, arg1, arg2) {
__exports.__wbg_subarray_570c38fd448b1fe6 = function(arg0, arg1, arg2) {
return addHeapObject(getObject(arg0).subarray(arg1, arg2));
};
__exports.__wbg_newnoargs_56431a307f4eb856 = function(arg0, arg1) {
__exports.__wbg_newnoargs_3c6fc8d4dae9ea25 = function(arg0, arg1) {
let varg0 = getStringFromWasm(arg0, arg1);
return addHeapObject(new Function(varg0));
};
__exports.__wbg_call_f6ee70703ec77c6c = function(arg0, arg1, exnptr) {
__exports.__wbg_call_d3e8beef2a1dcd98 = function(arg0, arg1, exnptr) {
try {
return addHeapObject(getObject(arg0).call(getObject(arg1)));
} catch (e) {
@ -369,33 +368,33 @@ __exports.__wbg_call_f6ee70703ec77c6c = function(arg0, arg1, exnptr) {
}
};
__exports.__wbg_new_138409b4887d6dd6 = function(arg0) {
__exports.__wbg_new_f76b11c0cbb3494f = function(arg0) {
return addHeapObject(new Int16Array(getObject(arg0)));
};
__exports.__wbg_subarray_783c98c421ae1b96 = function(arg0, arg1, arg2) {
__exports.__wbg_subarray_5939bb5593602b7f = function(arg0, arg1, arg2) {
return addHeapObject(getObject(arg0).subarray(arg1, arg2));
};
__exports.__wbg_new_0763112334e4d8dd = function(arg0) {
__exports.__wbg_new_0545b2bd45b80279 = function(arg0) {
return addHeapObject(new Uint8Array(getObject(arg0)));
};
__exports.__wbg_subarray_b0dbd9eb6fca9341 = function(arg0, arg1, arg2) {
__exports.__wbg_subarray_38d1753fa45ff9db = function(arg0, arg1, arg2) {
return addHeapObject(getObject(arg0).subarray(arg1, arg2));
};
__exports.__wbg_new_fad4b1eaf5748cf4 = function(arg0) {
__exports.__wbg_new_b00ac3cd4d449d77 = function(arg0) {
return addHeapObject(new Uint16Array(getObject(arg0)));
};
__exports.__wbg_subarray_20d7705e928d8a85 = function(arg0, arg1, arg2) {
__exports.__wbg_subarray_c2de59c144bab5a1 = function(arg0, arg1, arg2) {
return addHeapObject(getObject(arg0).subarray(arg1, arg2));
};
__exports.__wbg_instanceof_Memory_d6aeebcf1c6c121e = function(idx) { return getObject(idx) instanceof WebAssembly.Memory ? 1 : 0; };
__exports.__wbg_instanceof_Memory_98e1f75012963cf9 = function(idx) { return getObject(idx) instanceof WebAssembly.Memory ? 1 : 0; };
__exports.__wbg_buffer_8a74a93c17ac10c7 = function(arg0) {
__exports.__wbg_buffer_56cac7ead8d97f53 = function(arg0) {
return addHeapObject(getObject(arg0).buffer);
};
@ -498,6 +497,10 @@ function takeObject(idx) {
__exports.__wbindgen_rethrow = function(idx) { throw takeObject(idx); };
__exports.__wbindgen_throw = function(ptr, len) {
throw new Error(getStringFromWasm(ptr, len));
};
function freeState(ptr) {
wasm.__wbg_state_free(ptr);
@ -528,38 +531,40 @@ __exports.__wbindgen_object_clone_ref = function(idx) {
__exports.__wbindgen_object_drop_ref = function(i) { dropObject(i); };
__exports.__wbindgen_throw = function(ptr, len) {
throw new Error(getStringFromWasm(ptr, len));
};
function init(module_or_path, maybe_memory) {
let result;
const imports = { './example_wasm': __exports };
if (module_or_path instanceof WebAssembly.Module) {
function init(path_or_module) {
let instantiation;
const imports = { './example': __exports };
if (path_or_module instanceof WebAssembly.Module) {
instantiation = WebAssembly.instantiate(path_or_module, imports)
result = WebAssembly.instantiate(module_or_path, imports)
.then(instance => {
return { instance, module: path_or_module }
return { instance, module: module_or_path };
});
} else {
const data = fetch(path_or_module);
} else {
const response = fetch(module_or_path);
if (typeof WebAssembly.instantiateStreaming === 'function') {
instantiation = WebAssembly.instantiateStreaming(data, imports)
result = WebAssembly.instantiateStreaming(response, imports)
.catch(e => {
console.warn("`WebAssembly.instantiateStreaming` failed. Assuming this is because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
return data
return response
.then(r => r.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, imports));
});
} else {
instantiation = data
.then(response => response.arrayBuffer())
.then(buffer => WebAssembly.instantiate(buffer, imports));
result = response
.then(r => r.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, imports));
}
}
return result.then(({instance, module}) => {
wasm = instance.exports;
init.__wbindgen_wasm_module = module;
return wasm;
});
}
return instantiation.then(({instance}) => {
wasm = init.wasm = instance.exports;
});
};
self.wasm_bindgen = Object.assign(init, __exports);
})();

BIN
docs/example_bg.wasm → docs/example_wasm_bg.wasm

Binary file not shown.

4
docs/index.html

@ -41,13 +41,13 @@
</script>
<!-- this is the JS generated by the `wasm-bindgen` CLI tool -->
<script src="example.js"></script>
<script src="example_wasm.js"></script>
<script>
// we'll defer our execution until the wasm is ready to go
// here we tell bindgen the path to the wasm file so it can start
// initialization and return to us a promise when it's done
wasm_bindgen("./example_bg.wasm")
wasm_bindgen("./example_wasm_bg.wasm")
.then(on_wasm_loaded)["catch"](console.error);
// ----------------------------------------------------------------------------
var g_wasm_app = null;

2
example/Cargo.toml → example_wasm/Cargo.toml

@ -1,5 +1,5 @@
[package]
name = "example"
name = "example_wasm"
version = "0.1.0"
authors = ["Emil Ernerfeldt <emilernerfeldt@gmail.com>"]
edition = "2018"

0
example/src/app.rs → example_wasm/src/app.rs

0
example/src/lib.rs → example_wasm/src/lib.rs

Loading…
Cancel
Save