This commit is contained in:
Greg Shuflin 2024-10-20 20:27:37 -07:00
parent 5fd5300bd2
commit 6e13cc1d34
5 changed files with 2428 additions and 96 deletions

2485
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ edition = "2021"
anyhow = "1.0.89" anyhow = "1.0.89"
clap = { version = "4.5.20", features = ["derive"] } clap = { version = "4.5.20", features = ["derive"] }
floem = { git = "https://github.com/lapce/floem", branch = "main" } floem = { git = "https://github.com/lapce/floem", branch = "main" }
gpui = { git = "https://github.com/zed-industries/zed" }
iced = "0.13.1" iced = "0.13.1"
iced-tetris = { git = "https://code.everydayimshuflin.com/greg/tetres" } iced-tetris = { git = "https://code.everydayimshuflin.com/greg/tetres" }

View File

@ -3,7 +3,7 @@ _default:
run *args: run *args:
cargo run -- {{args}} cargo run --bin gui-playground -- {{args}}
floem: floem:

View File

@ -1,5 +1,33 @@
use anyhow::Result; use anyhow::Result;
use gpui::*;
pub fn main() -> Result<()> { // See https://www.gpui.rs/
Ok(())
struct HelloWorld {
text: SharedString,
}
impl Render for HelloWorld {
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
div()
.flex()
.bg(rgb(0x2e7d32))
.size_full()
.justify_center()
.items_center()
.text_xl()
.text_color(rgb(0xffffff))
.child(format!("Hello, {}!", &self.text))
}
}
pub(crate) fn main() {
App::new().run(|cx: &mut AppContext| {
cx.open_window(WindowOptions::default(), |cx| {
cx.new_view(|_cx| HelloWorld {
text: "World".into(),
})
})
.unwrap();
});
} }

View File

@ -27,7 +27,9 @@ fn main() -> Result<()> {
Command::IcedTetris => iced_tetris::tetris_main().map_err(|err| anyhow!(err)), Command::IcedTetris => iced_tetris::tetris_main().map_err(|err| anyhow!(err)),
Command::Egui => egui_main(), Command::Egui => egui_main(),
Command::Druid => druid_main(), Command::Druid => druid_main(),
Command::Gpui => gpui::main(), Command::Gpui => { gpui::main();
Ok(())
}
} }
} }