generated from luke-else/egui-template
Created Base Setup
This commit is contained in:
@ -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()))),
|
||||
)
|
||||
|
Reference in New Issue
Block a user