laughable first steps with egui
cargo devel CI / cargo CI (push) Successful in 3m47s
Details
cargo devel CI / cargo CI (push) Successful in 3m47s
Details
This commit is contained in:
parent
25d7f0d8b2
commit
0e6376d009
File diff suppressed because it is too large
Load Diff
|
@ -28,9 +28,11 @@ members = [
|
||||||
"members/statusline",
|
"members/statusline",
|
||||||
"members/clap-repl-demo",
|
"members/clap-repl-demo",
|
||||||
"members/arithmetics",
|
"members/arithmetics",
|
||||||
|
"members/egui-demo",
|
||||||
]
|
]
|
||||||
default-members = [
|
default-members = [
|
||||||
".",
|
".",
|
||||||
|
"members/egui-demo",
|
||||||
"members/arithmetics",
|
"members/arithmetics",
|
||||||
"members/statusline",
|
"members/statusline",
|
||||||
"members/ptlog",
|
"members/ptlog",
|
||||||
|
|
|
@ -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"
|
|
@ -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…
Reference in New Issue