From c22269bff3085012d326a0df77bf27ad5bcb41b7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 16 Mar 2024 05:33:47 +0100 Subject: Introduce `Program` API --- examples/bezier_tool/src/main.rs | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'examples/bezier_tool/src') diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index 897e7df8..1bd32e19 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -1,12 +1,12 @@ //! This example showcases an interactive `Canvas` for drawing Bézier curves. use iced::widget::{button, column, text}; -use iced::{Alignment, Element, Length, Sandbox, Settings}; +use iced::{Alignment, Element, Length}; pub fn main() -> iced::Result { - Example::run(Settings { - antialiasing: true, - ..Settings::default() - }) + iced::sandbox(Example::update, Example::view) + .title("Bezier tool - Iced") + .antialiased() + .run() } #[derive(Default)] @@ -21,17 +21,7 @@ enum Message { Clear, } -impl Sandbox for Example { - type Message = Message; - - fn new() -> Self { - Example::default() - } - - fn title(&self) -> String { - String::from("Bezier tool - Iced") - } - +impl Example { fn update(&mut self, message: Message) { match message { Message::AddCurve(curve) => { -- cgit