Update to modern libs

This commit is contained in:
Greg Shuflin 2024-09-30 20:56:33 -07:00
parent ba9c1e6dcc
commit a5bf20005e
4 changed files with 2610 additions and 2244 deletions

4795
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
[package] [package]
name = "gui-playground" name = "gui-playground"
version = "0.1.0" version = "0.1.0"
edition = "2018" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
anyhow = "1.0.89"
iced = "0.13.1"
iced = "0.3.0"
druid = "0.7.0"

View File

@ -1,10 +1,12 @@
use iced::{Application, Command, executor, Clipboard, Element, Text, Settings}; //use iced::{Application, Command, executor, Clipboard, Element, Text, Settings};
pub fn iced_main() -> iced::Result { pub fn iced_main() -> iced::Result {
println!("Iced"); println!("Iced");
Gamarjoba::run(Settings::default()) Ok(())
//Gamarjoba::run(Settings::default())
} }
/*
struct Gamarjoba; struct Gamarjoba;
@ -30,3 +32,4 @@ impl Application for Gamarjoba {
} }
} }
*/

View File

@ -1,35 +1,37 @@
mod iced; mod iced;
fn main() -> Result<(), std::io::Error> { use anyhow::{Result, anyhow};
fn main() -> Result<()> {
let args: Vec<String> = std::env::args().collect(); let args: Vec<String> = std::env::args().collect();
let framework = args.get(1).expect("Specify a GUI framework to run"); let framework = match args.get(1) {
Some(s) => s,
None => return Err(anyhow!("Specify a framework to use"))
};
match framework.as_str() { match framework.as_str() {
"iced" => { "iced" => {
iced::iced_main(); iced::iced_main().map_err(|err| anyhow!(err))
}, },
"druid" => { "druid" => druid_main(),
druid_main(); "egui" => egui_main(),
}, other => {
"egui" => { Err(anyhow!(r#"You specified {other}, allowed values: "iced", "egui""#))
egui_main();
},
x => {
println!(r#"You specified {}, allowed values: "iced", "druid", "egui""#, x);
} }
}; }
}
fn druid_main() -> Result<()> {
println!("druid");
Ok(())
}
fn egui_main() -> Result<()> {
println!("egui - not implemented yet");
Ok(()) Ok(())
} }
fn druid_main() {
println!("druid");
}
fn egui_main() {
println!("egui");
}