Iced hello world
This commit is contained in:
parent
1c737a8cec
commit
ba9c1e6dcc
32
src/iced.rs
Normal file
32
src/iced.rs
Normal file
@ -0,0 +1,32 @@
|
||||
use iced::{Application, Command, executor, Clipboard, Element, Text, Settings};
|
||||
|
||||
pub fn iced_main() -> iced::Result {
|
||||
println!("Iced");
|
||||
Gamarjoba::run(Settings::default())
|
||||
}
|
||||
|
||||
struct Gamarjoba;
|
||||
|
||||
|
||||
impl Application for Gamarjoba {
|
||||
type Executor = executor::Default;
|
||||
type Message = ();
|
||||
type Flags = ();
|
||||
|
||||
fn new(_flags: (),) -> (Self, Command<()>) {
|
||||
(Gamarjoba, Command::none())
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
"YOLO SWAGG 関ヶ原の乱 ჩემი სიტყვებში".to_owned()
|
||||
}
|
||||
|
||||
fn update(&mut self, _message: (), _clipboard: &mut Clipboard) -> Command<()> {
|
||||
Command::none()
|
||||
}
|
||||
|
||||
fn view(&mut self) -> Element<()> {
|
||||
Text::new("Gamarjoba, munde!").into()
|
||||
}
|
||||
|
||||
}
|
19
src/main.rs
19
src/main.rs
@ -1,12 +1,20 @@
|
||||
mod iced;
|
||||
|
||||
fn main() -> Result<(), std::io::Error> {
|
||||
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
|
||||
let framework = args.get(1).expect("Specify a GUI framework to run");
|
||||
match framework.as_str() {
|
||||
"iced" => iced_main(),
|
||||
"druid" => druid_main(),
|
||||
"egui" => egui_main(),
|
||||
"iced" => {
|
||||
iced::iced_main();
|
||||
},
|
||||
"druid" => {
|
||||
druid_main();
|
||||
},
|
||||
"egui" => {
|
||||
egui_main();
|
||||
},
|
||||
x => {
|
||||
println!(r#"You specified {}, allowed values: "iced", "druid", "egui""#, x);
|
||||
}
|
||||
@ -15,11 +23,6 @@ fn main() -> Result<(), std::io::Error> {
|
||||
}
|
||||
|
||||
|
||||
fn iced_main() {
|
||||
println!("Iced");
|
||||
|
||||
}
|
||||
|
||||
fn druid_main() {
|
||||
println!("druid");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user