chore: Adds hello world.

This commit is contained in:
greysoh 2024-04-28 15:20:18 -04:00
parent 510959df46
commit 6063a541d5
No known key found for this signature in database
GPG key ID: FE0F173B8FC01571
3 changed files with 40 additions and 4 deletions

View file

@ -6,3 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
eframe = "0.27.2"
egui = "0.27.2"

View file

@ -1,3 +1,28 @@
fn main() {
println!("Hello, world!");
use eframe::egui;
fn main() -> Result<(), eframe::Error> {
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 240.0]),
..Default::default()
};
// Our application state:
let mut name = "Arthur".to_owned();
let mut age = 42;
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}"));
});
})
}

View file

@ -18,6 +18,15 @@
export PRISMA_QUERY_ENGINE_LIBRARY=${pkgs.prisma-engines}/lib/libquery_engine.node
export PRISMA_SCHEMA_ENGINE_BINARY=${pkgs.prisma-engines}/bin/schema-engine
# egui patches!
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.wayland}/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.libxkbcommon}/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.xorg.libX11}/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.xorg.libXcursor}/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.xorg.libXrandr}/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.xorg.libXi}/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.libGL}/lib
source init.sh
'';
}