summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-20 06:27:01 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-20 06:27:01 +0100
commit7cea7371150e6de28032827519936008592f112d (patch)
tree3bfd82272094ef69493de622af6c9b06389a7c27 /examples
parent04086a90c9e933ebfb42de378054e1115b33529d (diff)
downloadiced-7cea7371150e6de28032827519936008592f112d.tar.gz
iced-7cea7371150e6de28032827519936008592f112d.tar.bz2
iced-7cea7371150e6de28032827519936008592f112d.zip
Package examples and remove `dev-dependencies`
Diffstat (limited to 'examples')
-rw-r--r--examples/bezier_tool/Cargo.toml12
-rw-r--r--examples/bezier_tool/src/main.rs (renamed from examples/bezier_tool.rs)0
-rw-r--r--examples/counter/Cargo.toml9
-rw-r--r--examples/counter/src/main.rs (renamed from examples/counter.rs)0
-rw-r--r--examples/custom_widget/Cargo.toml11
-rw-r--r--examples/custom_widget/src/main.rs (renamed from examples/custom_widget.rs)0
-rw-r--r--examples/events/Cargo.toml10
-rw-r--r--examples/events/src/main.rs (renamed from examples/events.rs)0
-rw-r--r--examples/geometry/Cargo.toml11
-rw-r--r--examples/geometry/src/main.rs (renamed from examples/geometry.rs)0
-rw-r--r--examples/pokedex/Cargo.toml14
-rw-r--r--examples/pokedex/src/main.rs (renamed from examples/pokedex.rs)4
-rw-r--r--examples/progress_bar/Cargo.toml9
-rw-r--r--examples/progress_bar/src/main.rs (renamed from examples/progress_bar.rs)0
-rw-r--r--examples/stopwatch/Cargo.toml12
-rw-r--r--examples/stopwatch/src/main.rs (renamed from examples/stopwatch.rs)2
-rw-r--r--examples/styling/Cargo.toml9
-rw-r--r--examples/styling/src/main.rs (renamed from examples/styling.rs)0
-rw-r--r--examples/svg.rs54
-rw-r--r--examples/svg/Cargo.toml9
-rw-r--r--examples/svg/resources/tiger.svg (renamed from examples/resources/tiger.svg)0
-rw-r--r--examples/svg/src/main.rs37
-rw-r--r--examples/todos/Cargo.toml16
-rw-r--r--examples/todos/fonts/icons.ttf (renamed from examples/resources/icons.ttf)bin5596 -> 5596 bytes
-rw-r--r--examples/todos/src/main.rs (renamed from examples/todos.rs)2
-rw-r--r--examples/tour/Cargo.toml13
-rw-r--r--examples/tour/images/ferris.png (renamed from examples/resources/ferris.png)bin33061 -> 33061 bytes
-rw-r--r--examples/tour/src/main.rs (renamed from examples/tour.rs)4
28 files changed, 179 insertions, 59 deletions
diff --git a/examples/bezier_tool/Cargo.toml b/examples/bezier_tool/Cargo.toml
new file mode 100644
index 00000000..b13a0aa5
--- /dev/null
+++ b/examples/bezier_tool/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "bezier_tool"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
+iced_native = { path = "../../native" }
+iced_wgpu = { path = "../../wgpu" }
+lyon = "0.15"
diff --git a/examples/bezier_tool.rs b/examples/bezier_tool/src/main.rs
index 043d265c..043d265c 100644
--- a/examples/bezier_tool.rs
+++ b/examples/bezier_tool/src/main.rs
diff --git a/examples/counter/Cargo.toml b/examples/counter/Cargo.toml
new file mode 100644
index 00000000..a763cd78
--- /dev/null
+++ b/examples/counter/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "counter"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
diff --git a/examples/counter.rs b/examples/counter/src/main.rs
index b85db70d..b85db70d 100644
--- a/examples/counter.rs
+++ b/examples/counter/src/main.rs
diff --git a/examples/custom_widget/Cargo.toml b/examples/custom_widget/Cargo.toml
new file mode 100644
index 00000000..30747dc0
--- /dev/null
+++ b/examples/custom_widget/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "custom_widget"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
+iced_native = { path = "../../native" }
+iced_wgpu = { path = "../../wgpu" }
diff --git a/examples/custom_widget.rs b/examples/custom_widget/src/main.rs
index 0a570745..0a570745 100644
--- a/examples/custom_widget.rs
+++ b/examples/custom_widget/src/main.rs
diff --git a/examples/events/Cargo.toml b/examples/events/Cargo.toml
new file mode 100644
index 00000000..f883075f
--- /dev/null
+++ b/examples/events/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "events"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
+iced_native = { path = "../../native" }
diff --git a/examples/events.rs b/examples/events/src/main.rs
index 0c9dca05..0c9dca05 100644
--- a/examples/events.rs
+++ b/examples/events/src/main.rs
diff --git a/examples/geometry/Cargo.toml b/examples/geometry/Cargo.toml
new file mode 100644
index 00000000..9df52454
--- /dev/null
+++ b/examples/geometry/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "geometry"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
+iced_native = { path = "../../native" }
+iced_wgpu = { path = "../../wgpu" }
diff --git a/examples/geometry.rs b/examples/geometry/src/main.rs
index 9d5fd611..9d5fd611 100644
--- a/examples/geometry.rs
+++ b/examples/geometry/src/main.rs
diff --git a/examples/pokedex/Cargo.toml b/examples/pokedex/Cargo.toml
new file mode 100644
index 00000000..2972590f
--- /dev/null
+++ b/examples/pokedex/Cargo.toml
@@ -0,0 +1,14 @@
+[package]
+name = "pokedex"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
+iced_futures = { path = "../../futures", features = ["async-std"] }
+surf = "1.0"
+rand = "0.7"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
diff --git a/examples/pokedex.rs b/examples/pokedex/src/main.rs
index 505dbf19..283437b2 100644
--- a/examples/pokedex.rs
+++ b/examples/pokedex/src/main.rs
@@ -1,6 +1,6 @@
use iced::{
- button, image, Align, Application, Button, Column, Command, Container,
- Element, Image, Length, Row, Settings, Text,
+ button, futures, image, Align, Application, Button, Column, Command,
+ Container, Element, Image, Length, Row, Settings, Text,
};
pub fn main() {
diff --git a/examples/progress_bar/Cargo.toml b/examples/progress_bar/Cargo.toml
new file mode 100644
index 00000000..4eccbf14
--- /dev/null
+++ b/examples/progress_bar/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "progress_bar"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
diff --git a/examples/progress_bar.rs b/examples/progress_bar/src/main.rs
index 43b09928..43b09928 100644
--- a/examples/progress_bar.rs
+++ b/examples/progress_bar/src/main.rs
diff --git a/examples/stopwatch/Cargo.toml b/examples/stopwatch/Cargo.toml
new file mode 100644
index 00000000..1dae3b83
--- /dev/null
+++ b/examples/stopwatch/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "stopwatch"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
+iced_native = { path = "../../native" }
+iced_futures = { path = "../../futures", features = ["async-std"] }
+async-std = { version = "1.0", features = ["unstable"] }
diff --git a/examples/stopwatch.rs b/examples/stopwatch/src/main.rs
index 6e357039..d84c4817 100644
--- a/examples/stopwatch.rs
+++ b/examples/stopwatch/src/main.rs
@@ -143,6 +143,8 @@ impl Application for Stopwatch {
}
mod time {
+ use iced::futures;
+
pub fn every(
duration: std::time::Duration,
) -> iced::Subscription<std::time::Instant> {
diff --git a/examples/styling/Cargo.toml b/examples/styling/Cargo.toml
new file mode 100644
index 00000000..eb729f93
--- /dev/null
+++ b/examples/styling/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "styling"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
diff --git a/examples/styling.rs b/examples/styling/src/main.rs
index 50095ec7..50095ec7 100644
--- a/examples/styling.rs
+++ b/examples/styling/src/main.rs
diff --git a/examples/svg.rs b/examples/svg.rs
deleted file mode 100644
index 1895039d..00000000
--- a/examples/svg.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use iced::{Container, Element, Length, Sandbox, Settings};
-
-pub fn main() {
- Tiger::run(Settings::default())
-}
-
-#[derive(Default)]
-struct Tiger;
-
-impl Sandbox for Tiger {
- type Message = ();
-
- fn new() -> Self {
- Self::default()
- }
-
- fn title(&self) -> String {
- String::from("SVG - Iced")
- }
-
- fn update(&mut self, _message: ()) {}
-
- fn view(&mut self) -> Element<()> {
- #[cfg(feature = "svg")]
- let content = {
- use iced::{Column, Svg};
-
- Column::new().padding(20).push(
- Svg::new(format!(
- "{}/examples/resources/tiger.svg",
- env!("CARGO_MANIFEST_DIR")
- ))
- .width(Length::Fill)
- .height(Length::Fill),
- )
- };
-
- #[cfg(not(feature = "svg"))]
- let content = {
- use iced::{HorizontalAlignment, Text};
-
- Text::new("You need to enable the `svg` feature!")
- .horizontal_alignment(HorizontalAlignment::Center)
- .size(30)
- };
-
- Container::new(content)
- .width(Length::Fill)
- .height(Length::Fill)
- .center_x()
- .center_y()
- .into()
- }
-}
diff --git a/examples/svg/Cargo.toml b/examples/svg/Cargo.toml
new file mode 100644
index 00000000..d8f83ac2
--- /dev/null
+++ b/examples/svg/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "svg"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../..", features = ["svg"] }
diff --git a/examples/resources/tiger.svg b/examples/svg/resources/tiger.svg
index 679edec2..679edec2 100644
--- a/examples/resources/tiger.svg
+++ b/examples/svg/resources/tiger.svg
diff --git a/examples/svg/src/main.rs b/examples/svg/src/main.rs
new file mode 100644
index 00000000..57358e24
--- /dev/null
+++ b/examples/svg/src/main.rs
@@ -0,0 +1,37 @@
+use iced::{Column, Container, Element, Length, Sandbox, Settings, Svg};
+
+pub fn main() {
+ Tiger::run(Settings::default())
+}
+
+#[derive(Default)]
+struct Tiger;
+
+impl Sandbox for Tiger {
+ type Message = ();
+
+ fn new() -> Self {
+ Self::default()
+ }
+
+ fn title(&self) -> String {
+ String::from("SVG - Iced")
+ }
+
+ fn update(&mut self, _message: ()) {}
+
+ fn view(&mut self) -> Element<()> {
+ let content = Column::new().padding(20).push(
+ Svg::new(format!("{}/tiger.svg", env!("CARGO_MANIFEST_DIR")))
+ .width(Length::Fill)
+ .height(Length::Fill),
+ );
+
+ Container::new(content)
+ .width(Length::Fill)
+ .height(Length::Fill)
+ .center_x()
+ .center_y()
+ .into()
+ }
+}
diff --git a/examples/todos/Cargo.toml b/examples/todos/Cargo.toml
new file mode 100644
index 00000000..53a135e6
--- /dev/null
+++ b/examples/todos/Cargo.toml
@@ -0,0 +1,16 @@
+[package]
+name = "todos"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+iced = { path = "../.." }
+iced_futures = { path = "../../futures", features = ["async-std"] }
+async-std = "1.0"
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+directories = "2.0"
diff --git a/examples/resources/icons.ttf b/examples/todos/fonts/icons.ttf
index 4498299d..4498299d 100644
--- a/examples/resources/icons.ttf
+++ b/examples/todos/fonts/icons.ttf
Binary files differ
diff --git a/examples/todos.rs b/examples/todos/src/main.rs
index 06595a1e..c6ddf2ea 100644
--- a/examples/todos.rs
+++ b/examples/todos/src/main.rs
@@ -451,7 +451,7 @@ fn empty_message(message: &str) -> Element<'static, Message> {
// Fonts
const ICONS: Font = Font::External {
name: "Icons",
- bytes: include_bytes!("resources/icons.ttf"),
+ bytes: include_bytes!("../fonts/icons.ttf"),
};
fn icon(unicode: char) -> Text {
diff --git a/examples/tour/Cargo.toml b/examples/tour/Cargo.toml
new file mode 100644
index 00000000..10c3f1da
--- /dev/null
+++ b/examples/tour/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "tour"
+version = "0.1.0"
+authors = ["Héctor Ramón Jiménez <hector0193@gmail.com>"]
+edition = "2018"
+publish = false
+
+[dependencies]
+iced = { path = "../.." }
+env_logger = "0.7"
+
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+wasm-bindgen = "0.2.51"
diff --git a/examples/resources/ferris.png b/examples/tour/images/ferris.png
index ebce1a14..ebce1a14 100644
--- a/examples/resources/ferris.png
+++ b/examples/tour/images/ferris.png
Binary files differ
diff --git a/examples/tour.rs b/examples/tour/src/main.rs
index b0ee4d96..43c7e50f 100644
--- a/examples/tour.rs
+++ b/examples/tour/src/main.rs
@@ -681,10 +681,10 @@ fn ferris<'a>(width: u16) -> Container<'a, StepMessage> {
// This should go away once we unify resource loading on native
// platforms
if cfg!(target_arch = "wasm32") {
- Image::new("resources/ferris.png")
+ Image::new("images/ferris.png")
} else {
Image::new(format!(
- "{}/examples/resources/ferris.png",
+ "{}/images/ferris.png",
env!("CARGO_MANIFEST_DIR")
))
}