Gpui
This commit is contained in:
parent
5fd5300bd2
commit
6e13cc1d34
2485
Cargo.lock
generated
2485
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -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" }
|
||||||
|
|
||||||
|
2
justfile
2
justfile
@ -3,7 +3,7 @@ _default:
|
|||||||
|
|
||||||
|
|
||||||
run *args:
|
run *args:
|
||||||
cargo run -- {{args}}
|
cargo run --bin gui-playground -- {{args}}
|
||||||
|
|
||||||
|
|
||||||
floem:
|
floem:
|
||||||
|
32
src/gpui.rs
32
src/gpui.rs
@ -1,5 +1,33 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
use gpui::*;
|
||||||
|
|
||||||
|
// See https://www.gpui.rs/
|
||||||
|
|
||||||
pub fn main() -> Result<()> {
|
struct HelloWorld {
|
||||||
Ok(())
|
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();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -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(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user