Introduce Program API

This commit is contained in:
Héctor Ramón Jiménez 2024-03-16 05:33:47 +01:00
parent 0524e9b457
commit c22269bff3
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
43 changed files with 1141 additions and 831 deletions

View file

@ -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,