diff options
author | 2021-06-25 17:16:44 +0200 | |
---|---|---|
committer | 2021-06-25 17:33:40 +0200 | |
commit | 5c45d36d1a8cfd92cd1a454a7f4deedcd4d13fe7 (patch) | |
tree | ef903447347a70a4a350f390241b576bf262046a /examples | |
parent | 52d44769a332d1d96a5e9292805a5884073b9185 (diff) | |
download | iced-5c45d36d1a8cfd92cd1a454a7f4deedcd4d13fe7.tar.gz iced-5c45d36d1a8cfd92cd1a454a7f4deedcd4d13fe7.tar.bz2 iced-5c45d36d1a8cfd92cd1a454a7f4deedcd4d13fe7.zip |
wip
Diffstat (limited to 'examples')
-rw-r--r-- | examples/winit/Cargo.toml | 2 | ||||
-rw-r--r-- | examples/winit/src/main.rs | 27 |
2 files changed, 16 insertions, 13 deletions
diff --git a/examples/winit/Cargo.toml b/examples/winit/Cargo.toml index 6d16a7a9..2d58f031 100644 --- a/examples/winit/Cargo.toml +++ b/examples/winit/Cargo.toml @@ -6,4 +6,4 @@ edition = "2018" publish = false [dependencies] -iced_winit = { path = "../../winit" } +iced = { path = "../.." } diff --git a/examples/winit/src/main.rs b/examples/winit/src/main.rs index 890ded79..202d9b5a 100644 --- a/examples/winit/src/main.rs +++ b/examples/winit/src/main.rs @@ -1,7 +1,15 @@ -use iced_winit::{button, Align, Button, Column, Element, Application, Settings, Text, Renderer, Program, Command}; +use iced::{button, Align, Button, Column, Element, Sandbox, Settings, window::Settings as WindowSettings, Text}; pub fn main() { - Counter::run(Settings::default()).unwrap() + let settings = Settings { + window: WindowSettings { + size: (400, 200), + position: (100, 100), + ..Default::default() + }, + ..Default::default() + }; + Counter::run(settings).unwrap() } #[derive(Default)] @@ -17,21 +25,16 @@ enum Message { DecrementPressed, } -impl Application for Counter { - type Flags = (); +impl Sandbox for Counter { + type Message = Message; - fn new(flags: Self::Flags) -> (Self, Command<Message>) { - (Self::default(), Command::none()) + fn new() -> Self { + Self::default() } fn title(&self) -> String { String::from("Counter with winit - Iced") } -} - -impl Program for Counter { - type Renderer = Renderer; - type Message = Message; fn update(&mut self, message: Message) { match message { @@ -44,7 +47,7 @@ impl Program for Counter { } } - fn view(&mut self) -> Element<Message, Self::Renderer> { + fn view(&mut self) -> Element<Message> { Column::new() .padding(20) .align_items(Align::Center) |