diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..de33542 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,45 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'egui-template'", + "cargo": { + "args": [ + "build", + "--bin=egui-template", + "--package=egui-template" + ], + "filter": { + "name": "egui-template", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'egui-template'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=egui-template", + "--package=egui-template" + ], + "filter": { + "name": "egui-template", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a2de48e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "egui-template" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +egui = "0.21.0" +eframe = "0.21.3" +tracing-subscriber = "0.3.16" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..850e421 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,39 @@ +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release + +use eframe::egui; + +fn main() -> Result<(), eframe::Error> { + // Log to stdout (if you run with `RUST_LOG=debug`). + tracing_subscriber::fmt::init(); + + let options = eframe::NativeOptions { + initial_window_size: Some(egui::vec2(150.0, 50.0)), + resizable: false, + ..Default::default() + }; + eframe::run_native( + "egui-template", + options, + Box::new(|_cc| Box::new(MyApp::default())), + ) +} + +struct MyApp { + name: String +} + +impl Default for MyApp { + fn default() -> Self { + Self { + name: "Hello, World!".to_owned() + } + } +} + +impl eframe::App for MyApp { + fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { + egui::CentralPanel::default().show(ctx, |ui| { + ui.heading(&self.name); + }); + } +} \ No newline at end of file