Remove sandbox by making application more generic 🎉

This commit is contained in:
Héctor Ramón Jiménez 2024-03-16 19:14:13 +01:00
parent 0a24611ccd
commit 28a27f08ed
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
23 changed files with 80 additions and 111 deletions

View file

@ -7,7 +7,7 @@ use iced::widget::canvas::{
use iced::{Element, Length, Point, Rectangle, Renderer, Subscription, Theme};
pub fn main() -> iced::Result {
iced::sandbox("Arc - Iced", Arc::update, Arc::view)
iced::application("Arc - Iced", Arc::update, Arc::view)
.subscription(Arc::subscription)
.theme(|_| Theme::Dark)
.antialiased()

View file

@ -3,7 +3,7 @@ use iced::widget::{button, column, text};
use iced::{Alignment, Element, Length};
pub fn main() -> iced::Result {
iced::sandbox("Bezier Tool - Iced", Example::update, Example::view)
iced::application("Bezier Tool - Iced", Example::update, Example::view)
.antialiased()
.run()
}

View file

@ -4,7 +4,7 @@ use iced::{Element, Font, Length};
const ICON_FONT: Font = Font::with_name("icons");
pub fn main() -> iced::Result {
iced::sandbox("Checkbox - Iced", Example::update, Example::view)
iced::application("Checkbox - Iced", Example::update, Example::view)
.font(include_bytes!("../fonts/icons.ttf").as_slice())
.run()
}

View file

@ -8,7 +8,7 @@ use iced::{
};
pub fn main() -> iced::Result {
iced::sandbox("Clock - Iced", Clock::update, Clock::view)
iced::application("Clock - Iced", Clock::update, Clock::view)
.subscription(Clock::subscription)
.theme(Clock::theme)
.antialiased()

View file

@ -13,7 +13,7 @@ use std::marker::PhantomData;
use std::ops::RangeInclusive;
pub fn main() -> iced::Result {
iced::sandbox(
iced::application(
"Color Palette - Iced",
ColorPalette::update,
ColorPalette::view,

View file

@ -9,9 +9,13 @@ use iced::window;
use iced::{Alignment, Color, Element, Length, Subscription};
fn main() -> iced::Result {
iced::sandbox("Custom Shader - Iced", IcedCubes::update, IcedCubes::view)
.subscription(IcedCubes::subscription)
.run()
iced::application(
"Custom Shader - Iced",
IcedCubes::update,
IcedCubes::view,
)
.subscription(IcedCubes::subscription)
.run()
}
struct IcedCubes {

View file

@ -4,9 +4,13 @@ use iced::widget::{button, column, container, progress_bar, text, Column};
use iced::{Alignment, Element, Length, Subscription};
pub fn main() -> iced::Result {
iced::sandbox("Download Progress - Iced", Example::update, Example::view)
.subscription(Example::subscription)
.run()
iced::application(
"Download Progress - Iced",
Example::update,
Example::view,
)
.subscription(Example::subscription)
.run()
}
#[derive(Debug)]

View file

@ -151,7 +151,7 @@ use iced::{Element, Length};
use rainbow::rainbow;
pub fn main() -> iced::Result {
iced::run("Custom 2D Geometry - Iced", |_, _| {}, view)
iced::run("Custom 2D Geometry - Iced", |_: &mut _, _| {}, view)
}
fn view(_state: &()) -> Element<'_, ()> {

View file

@ -10,7 +10,7 @@ use iced::{
};
pub fn main() -> iced::Result {
iced::sandbox(Layout::title, Layout::update, Layout::view)
iced::application(Layout::title, Layout::update, Layout::view)
.subscription(Layout::subscription)
.theme(Layout::theme)
.run()

View file

@ -11,7 +11,7 @@ use circular::Circular;
use linear::Linear;
pub fn main() -> iced::Result {
iced::sandbox(
iced::application(
"Loading Spinners - Iced",
LoadingSpinners::update,
LoadingSpinners::view,

View file

@ -13,7 +13,7 @@ use std::collections::HashMap;
pub fn main() -> iced::Result {
tracing_subscriber::fmt::init();
iced::sandbox("Multitouch - Iced", Multitouch::update, Multitouch::view)
iced::application("Multitouch - Iced", Multitouch::update, Multitouch::view)
.antialiased()
.centered()
.run()

View file

@ -7,7 +7,7 @@ use iced::widget::{
use iced::{Color, Element, Length, Size, Subscription};
pub fn main() -> iced::Result {
iced::sandbox("Pane Grid - Iced", Example::update, Example::view)
iced::application("Pane Grid - Iced", Example::update, Example::view)
.subscription(Example::subscription)
.run()
}

View file

@ -4,7 +4,7 @@ use iced::widget::{
use iced::{Alignment, Element, Length, Theme};
pub fn main() -> iced::Result {
iced::sandbox(
iced::application(
"QR Code Generator - Iced",
QRGenerator::update,
QRGenerator::view,

View file

@ -8,7 +8,7 @@ use rand::Rng;
use std::fmt::Debug;
fn main() -> iced::Result {
iced::sandbox(
iced::application(
"Sierpinski Triangle - Iced",
SierpinskiEmulator::update,
SierpinskiEmulator::view,

View file

@ -22,7 +22,7 @@ use std::time::Instant;
pub fn main() -> iced::Result {
tracing_subscriber::fmt::init();
iced::sandbox(
iced::application(
"Solar System - Iced",
SolarSystem::update,
SolarSystem::view,

View file

@ -7,7 +7,7 @@ use iced::{Alignment, Element, Length, Subscription, Theme};
use std::time::{Duration, Instant};
pub fn main() -> iced::Result {
iced::sandbox("Stopwatch - Iced", Stopwatch::update, Stopwatch::view)
iced::application("Stopwatch - Iced", Stopwatch::update, Stopwatch::view)
.subscription(Stopwatch::subscription)
.theme(Stopwatch::theme)
.run()

View file

@ -6,7 +6,7 @@ use iced::widget::{
use iced::{Alignment, Element, Length, Theme};
pub fn main() -> iced::Result {
iced::sandbox("Styling - Iced", Styling::update, Styling::view)
iced::application("Styling - Iced", Styling::update, Styling::view)
.theme(Styling::theme)
.run()
}

View file

@ -16,7 +16,7 @@ pub fn main() -> iced::Result {
#[cfg(not(target_arch = "wasm32"))]
tracing_subscriber::fmt::init();
iced::sandbox(Tour::title, Tour::update, Tour::view)
iced::application(Tour::title, Tour::update, Tour::view)
.centered()
.run()
}

View file

@ -3,7 +3,7 @@ use iced::widget::{container, text};
use iced::{Element, Length, Subscription};
pub fn main() -> iced::Result {
iced::sandbox("URL Handler - Iced", App::update, App::view)
iced::application("URL Handler - Iced", App::update, App::view)
.subscription(App::subscription)
.run()
}

View file

@ -6,7 +6,7 @@ use iced::widget::{
use iced::{Element, Length, Point, Rectangle, Renderer, Theme, Vector};
pub fn main() -> iced::Result {
iced::sandbox(
iced::application(
"Vectorial Text - Iced",
VectorialText::update,
VectorialText::view,