laughable first steps with egui
All checks were successful
cargo devel CI / cargo CI (push) Successful in 3m47s
All checks were successful
cargo devel CI / cargo CI (push) Successful in 3m47s
This commit is contained in:
parent
25d7f0d8b2
commit
0e6376d009
4 changed files with 2753 additions and 39 deletions
2759
Cargo.lock
generated
2759
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -28,9 +28,11 @@ members = [
|
|||
"members/statusline",
|
||||
"members/clap-repl-demo",
|
||||
"members/arithmetics",
|
||||
"members/egui-demo",
|
||||
]
|
||||
default-members = [
|
||||
".",
|
||||
"members/egui-demo",
|
||||
"members/arithmetics",
|
||||
"members/statusline",
|
||||
"members/ptlog",
|
||||
|
|
9
members/egui-demo/Cargo.toml
Normal file
9
members/egui-demo/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "egui-demo"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
eframe = "0.28.1"
|
||||
egui = "0.28.1"
|
22
members/egui-demo/src/main.rs
Normal file
22
members/egui-demo/src/main.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
fn main() -> eframe::Result {
|
||||
// Our application state:
|
||||
let mut name = "Arthur".to_owned();
|
||||
let mut age = 42;
|
||||
|
||||
let options = eframe::NativeOptions::default();
|
||||
eframe::run_simple_native("My egui App", options, move |ctx, _frame| {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading("My egui Application");
|
||||
ui.horizontal(|ui| {
|
||||
let name_label = ui.label("Your name: ");
|
||||
ui.text_edit_singleline(&mut name)
|
||||
.labelled_by(name_label.id);
|
||||
});
|
||||
ui.add(egui::Slider::new(&mut age, 0..=120).text("age"));
|
||||
if ui.button("Increment").clicked() {
|
||||
age += 1;
|
||||
}
|
||||
ui.label(format!("Hello '{name}', age {age}"));
|
||||
});
|
||||
})
|
||||
}
|
Loading…
Add table
Reference in a new issue