generated from luke-else/egui-template
Created Base Setup
This commit is contained in:
parent
92e13e1c1d
commit
1e1d3bf0b1
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "egui-template"
|
||||
name = "AvBag"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
# egui-template
|
||||
# AvBag
|
||||
|
||||
Template repo for an egui application in rust
|
||||
Rust application to serve as a Aviation Flight Bag
|
@ -1,15 +1,21 @@
|
||||
mod ui;
|
||||
|
||||
/// Stuct to store the state of the running application
|
||||
pub struct App {
|
||||
name: String
|
||||
pub struct App<'a> {
|
||||
name: &'a str,
|
||||
icao: Vec<&'a str>,
|
||||
metars: Vec<&'a str>,
|
||||
tafs: Vec<&'a str>
|
||||
}
|
||||
|
||||
impl Default for App {
|
||||
impl <'a> Default for App<'a> {
|
||||
/// Creates the default startup state for the app;
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
name: String::from("Hello, World!")
|
||||
name: "AvBag - Welcome",
|
||||
icao: vec![],
|
||||
metars: vec![],
|
||||
tafs: vec![]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +1,14 @@
|
||||
use crate::app::App;
|
||||
use crate::theme::onedark::ONE_DARK;
|
||||
|
||||
impl eframe::App for App {
|
||||
impl <'a>eframe::App for App<'a> {
|
||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
let background_frame = egui::Frame::default().fill(ONE_DARK.bg);
|
||||
|
||||
egui::CentralPanel::default()
|
||||
.frame(background_frame)
|
||||
.show(ctx, |ui| {
|
||||
ui.heading(&self.name);
|
||||
ui.heading(self.name);
|
||||
});
|
||||
|
||||
egui::Window::new("test window")
|
||||
.collapsible(false)
|
||||
.auto_sized()
|
||||
.show(ctx, |ui| {
|
||||
ui.heading(&self.name);
|
||||
|
||||
for _ in 0..10 {
|
||||
ui.add(egui::Button::new(&self.name));
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||
|
||||
//Start rendering and run the application
|
||||
eframe::run_native(
|
||||
"egui-template",
|
||||
"AvBag",
|
||||
options,
|
||||
Box::new(|_cc| Ok(Box::new(App::default()))),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user