summaryrefslogtreecommitdiffstats
path: root/examples/svg/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2020-01-21 00:15:01 +0100
committerLibravatar GitHub <noreply@github.com>2020-01-21 00:15:01 +0100
commit7016221556ea8183ebcd8ef8df00044e2eda71e7 (patch)
treebc1609b71b88437fc7497af339b6427f63121c76 /examples/svg/src
parent6ca5e6184f9f1c12b427bdafcce0b4e9fbc5bb14 (diff)
parent91d9d65a03ce9b211e4043726e7424949d314325 (diff)
downloadiced-7016221556ea8183ebcd8ef8df00044e2eda71e7.tar.gz
iced-7016221556ea8183ebcd8ef8df00044e2eda71e7.tar.bz2
iced-7016221556ea8183ebcd8ef8df00044e2eda71e7.zip
Merge pull request #164 from hecrj/feature/custom-runtime
Custom futures executor with `iced_futures`
Diffstat (limited to 'examples/svg/src')
-rw-r--r--examples/svg/src/main.rs37
1 files changed, 37 insertions, 0 deletions
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()
+ }
+}