summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-09-19 15:01:12 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-09-19 15:01:12 +0200
commitf9de39ddaa3020a9585b1648afb0ead45dfd7aa9 (patch)
tree04289787e353b4b059354d22ce53f2b79464431c /web
parentdd093c79d7da84675be648c7df2ebfc85b5039f2 (diff)
downloadiced-f9de39ddaa3020a9585b1648afb0ead45dfd7aa9.tar.gz
iced-f9de39ddaa3020a9585b1648afb0ead45dfd7aa9.tar.bz2
iced-f9de39ddaa3020a9585b1648afb0ead45dfd7aa9.zip
Unify `web` and `ggez` tour examples :tada:
Diffstat (limited to '')
-rw-r--r--examples/tour/index.html (renamed from web/examples/tour/index.html)6
-rw-r--r--examples/tour/src/tour.rs (renamed from web/examples/tour/src/tour.rs)2
-rw-r--r--examples/tour/src/web.rs (renamed from web/examples/tour/src/lib.rs)4
-rw-r--r--src/color.rs (renamed from web/src/color.rs)3
-rw-r--r--web/examples/tour/Cargo.toml17
l---------web/examples/tour/resources/ferris.png1
-rw-r--r--web/src/lib.rs4
7 files changed, 9 insertions, 28 deletions
diff --git a/web/examples/tour/index.html b/examples/tour/index.html
index 527cc54c..b17ac4a2 100644
--- a/web/examples/tour/index.html
+++ b/examples/tour/index.html
@@ -2,12 +2,12 @@
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
- <title>Web Tour - Iced</title>
+ <title>Tour - Iced</title>
</head>
<body>
<script type="module">
- import init from "./pkg/iced_web_tour.js";
- init("./pkg/iced_web_tour_bg.wasm");
+ import init from "./pkg/iced_tour.js";
+ init("./pkg/iced_tour_bg.wasm");
</script>
</body>
</html>
diff --git a/web/examples/tour/src/tour.rs b/examples/tour/src/tour.rs
index 9a60e092..4bd7c8a3 100644
--- a/web/examples/tour/src/tour.rs
+++ b/examples/tour/src/tour.rs
@@ -1,4 +1,4 @@
-use iced_web::{
+use crate::widget::{
button, slider, text::HorizontalAlignment, Align, Button, Checkbox, Color,
Column, Element, Image, Radio, Row, Slider, Text,
};
diff --git a/web/examples/tour/src/lib.rs b/examples/tour/src/web.rs
index dbf04df8..a0a3060f 100644
--- a/web/examples/tour/src/lib.rs
+++ b/examples/tour/src/web.rs
@@ -2,9 +2,7 @@ use futures::Future;
use iced_web::UserInterface;
use wasm_bindgen::prelude::*;
-mod tour;
-
-use tour::Tour;
+use crate::tour::{self, Tour};
#[wasm_bindgen(start)]
pub fn run() {
diff --git a/web/src/color.rs b/src/color.rs
index 2624c3c9..5cc3a084 100644
--- a/web/src/color.rs
+++ b/src/color.rs
@@ -1,4 +1,6 @@
+/// A color in the sRGB color space.
#[derive(Debug, Clone, Copy, PartialEq)]
+#[allow(missing_docs)]
pub struct Color {
pub r: f32,
pub g: f32,
@@ -7,6 +9,7 @@ pub struct Color {
}
impl Color {
+ /// The black color.
pub const BLACK: Color = Color {
r: 0.0,
g: 0.0,
diff --git a/web/examples/tour/Cargo.toml b/web/examples/tour/Cargo.toml
deleted file mode 100644
index 65a860e2..00000000
--- a/web/examples/tour/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-[package]
-name = "iced_web_tour"
-version = "0.0.0"
-authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
-edition = "2018"
-publish = false
-
-[lib]
-crate-type = ["cdylib"]
-
-[dependencies]
-iced_web = { path = "../.." }
-wasm-bindgen = "0.2.50"
-futures-preview = "=0.3.0-alpha.18"
-log = "0.4"
-console_error_panic_hook = "0.1.6"
-console_log = "0.1.2"
diff --git a/web/examples/tour/resources/ferris.png b/web/examples/tour/resources/ferris.png
deleted file mode 120000
index 9c4fb51c..00000000
--- a/web/examples/tour/resources/ferris.png
+++ /dev/null
@@ -1 +0,0 @@
-../../../../examples/resources/ferris.png \ No newline at end of file
diff --git a/web/src/lib.rs b/web/src/lib.rs
index 5a0dd6f2..a6dc2b79 100644
--- a/web/src/lib.rs
+++ b/web/src/lib.rs
@@ -3,14 +3,12 @@ use futures::Future;
use std::cell::RefCell;
mod bus;
-mod color;
mod element;
mod widget;
pub use bus::Bus;
-pub use color::Color;
pub use element::Element;
-pub use iced::Align;
+pub use iced::{Align, Color};
pub use widget::*;
pub trait UserInterface {