summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-23 02:34:11 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-10-23 02:34:11 +0200
commit614514081640df35edb9a04bc10c42e951a48f61 (patch)
treea8707163a776e38b6eb8c0a85e4d5ef232c8ec03 /examples
parentc7ef9d0da705d8f27011fe41d2103c73aae42d2d (diff)
downloadiced-614514081640df35edb9a04bc10c42e951a48f61.tar.gz
iced-614514081640df35edb9a04bc10c42e951a48f61.tar.bz2
iced-614514081640df35edb9a04bc10c42e951a48f61.zip
Make `tour` example work on Wasm again
Diffstat (limited to 'examples')
-rw-r--r--examples/tour.html5
-rw-r--r--examples/tour.rs21
2 files changed, 20 insertions, 6 deletions
diff --git a/examples/tour.html b/examples/tour.html
index b17ac4a2..35360e59 100644
--- a/examples/tour.html
+++ b/examples/tour.html
@@ -6,8 +6,9 @@
</head>
<body>
<script type="module">
- import init from "./pkg/iced_tour.js";
- init("./pkg/iced_tour_bg.wasm");
+ import init from "./tour/tour.js";
+
+ init('./tour/tour_bg.wasm');
</script>
</body>
</html>
diff --git a/examples/tour.rs b/examples/tour.rs
index 06be4766..59a8c525 100644
--- a/examples/tour.rs
+++ b/examples/tour.rs
@@ -308,7 +308,7 @@ impl<'a> Step {
that can be easily implemented on top of Iced.",
))
.push(Text::new(
- "Iced is a renderer-agnostic GUI library for Rust focused on \
+ "Iced is a cross-platform GUI library for Rust focused on \
simplicity and type-safety. It is heavily inspired by Elm.",
))
.push(Text::new(
@@ -316,9 +316,9 @@ impl<'a> Step {
2D game engine for Rust.",
))
.push(Text::new(
- "Iced does not provide a built-in renderer. On native \
- platforms, this example runs on a fairly simple renderer \
- built on top of ggez, another game library.",
+ "On native platforms, Iced provides by default a renderer \
+ built on top of wgpu, a graphics library supporting Vulkan, \
+ Metal, DX11, and DX12.",
))
.push(Text::new(
"Additionally, this tour can also run on WebAssembly thanks \
@@ -634,3 +634,16 @@ pub enum Layout {
Row,
Column,
}
+
+// This should be gracefully handled by Iced in the future. Probably using our
+// own proc macro, or maybe the whole process is streamlined by `wasm-pack` at
+// some point.
+#[cfg(target_arch = "wasm32")]
+mod wasm {
+ use wasm_bindgen::prelude::*;
+
+ #[wasm_bindgen(start)]
+ pub fn run() {
+ super::main()
+ }
+}