diff options
author | 2024-03-16 05:33:47 +0100 | |
---|---|---|
committer | 2024-03-16 05:33:47 +0100 | |
commit | c22269bff3085012d326a0df77bf27ad5bcb41b7 (patch) | |
tree | 1083f21d012ab2bac88fb51537d4dc431bc7f170 /examples/tour/src | |
parent | 0524e9b4571d264018656418f02a1f9e27e268d7 (diff) | |
download | iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.gz iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.tar.bz2 iced-c22269bff3085012d326a0df77bf27ad5bcb41b7.zip |
Introduce `Program` API
Diffstat (limited to 'examples/tour/src')
-rw-r--r-- | examples/tour/src/main.rs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index f5791ad7..c373502e 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -4,7 +4,7 @@ use iced::widget::{ scrollable, slider, text, text_input, toggler, vertical_space, }; use iced::widget::{Button, Column, Container, Slider}; -use iced::{Color, Element, Font, Length, Pixels, Sandbox, Settings}; +use iced::{Color, Element, Font, Length, Pixels}; pub fn main() -> iced::Result { #[cfg(target_arch = "wasm32")] @@ -16,7 +16,10 @@ pub fn main() -> iced::Result { #[cfg(not(target_arch = "wasm32"))] tracing_subscriber::fmt::init(); - Tour::run(Settings::default()) + iced::sandbox(Tour::update, Tour::view) + .title(Tour::title) + .centered() + .run() } pub struct Tour { @@ -24,11 +27,9 @@ pub struct Tour { debug: bool, } -impl Sandbox for Tour { - type Message = Message; - - fn new() -> Tour { - Tour { +impl Tour { + fn new() -> Self { + Self { steps: Steps::new(), debug: false, } @@ -90,6 +91,12 @@ impl Sandbox for Tour { } } +impl Default for Tour { + fn default() -> Self { + Self::new() + } +} + #[derive(Debug, Clone)] pub enum Message { BackPressed, |