diff options
author | 2020-05-28 21:52:34 +0200 | |
---|---|---|
committer | 2020-05-28 21:52:34 +0200 | |
commit | d3db055583f4cbef1441fd66d07da70424bd1200 (patch) | |
tree | 9f695bd26f688a5aaf3b8fa687a0e3ff096ffe11 /examples/tour/src/main.rs | |
parent | ead4186870d1b46015986f702dd63382498060fc (diff) | |
parent | 709ed1f3f7ad8cf67a176763e394aaae4e808e93 (diff) | |
download | iced-d3db055583f4cbef1441fd66d07da70424bd1200.tar.gz iced-d3db055583f4cbef1441fd66d07da70424bd1200.tar.bz2 iced-d3db055583f4cbef1441fd66d07da70424bd1200.zip |
Merge pull request #354 from hecrj/feature/glow-renderer
OpenGL renderer and backend-agnostic graphics subcrate
Diffstat (limited to '')
-rw-r--r-- | examples/tour/src/main.rs | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index c9678b9d..c0bd2efe 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -1,7 +1,8 @@ use iced::{ - button, scrollable, slider, text_input, Button, Checkbox, Color, Column, - Container, Element, HorizontalAlignment, Image, Length, Radio, Row, - Sandbox, Scrollable, Settings, Slider, Space, Text, TextInput, + button, executor, scrollable, slider, text_input, Application, Button, + Checkbox, Color, Column, Command, Container, Element, HorizontalAlignment, + Image, Length, Radio, Row, Scrollable, Settings, Slider, Space, Text, + TextInput, }; pub fn main() { @@ -18,24 +19,29 @@ pub struct Tour { debug: bool, } -impl Sandbox for Tour { +impl Application for Tour { + type Executor = executor::Null; type Message = Message; - - fn new() -> Tour { - Tour { - steps: Steps::new(), - scroll: scrollable::State::new(), - back_button: button::State::new(), - next_button: button::State::new(), - debug: false, - } + type Flags = (); + + fn new(_flags: ()) -> (Tour, Command<Message>) { + ( + Tour { + steps: Steps::new(), + scroll: scrollable::State::new(), + back_button: button::State::new(), + next_button: button::State::new(), + debug: false, + }, + Command::none(), + ) } fn title(&self) -> String { format!("{} - Iced", self.steps.title()) } - fn update(&mut self, event: Message) { + fn update(&mut self, event: Message) -> Command<Message> { match event { Message::BackPressed => { self.steps.go_back(); @@ -47,6 +53,8 @@ impl Sandbox for Tour { self.steps.update(step_msg, &mut self.debug); } } + + Command::none() } fn view(&mut self) -> Element<Message> { @@ -764,7 +772,7 @@ mod style { Button::Secondary => Color::from_rgb(0.5, 0.5, 0.5), })), border_radius: 12, - shadow_offset: Vector::new(1.0, 1.0), + shadow_offset: Vector::new(0.0, 1.0), text_color: Color::from_rgb8(0xEE, 0xEE, 0xEE), ..button::Style::default() } @@ -773,7 +781,7 @@ mod style { fn hovered(&self) -> button::Style { button::Style { text_color: Color::WHITE, - shadow_offset: Vector::new(1.0, 2.0), + shadow_offset: Vector::new(0.0, 2.0), ..self.active() } } |