-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@_list: | ||
just --list --unsorted | ||
|
||
|
||
run: | ||
cargo run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/// We derive Deserialize/Serialize so we can persist app state on shutdown. | ||
#[derive(serde::Deserialize, serde::Serialize)] | ||
#[serde(default)] // if we add new fields, give them default values when deserializing old state | ||
pub struct TypeFastApp { | ||
label: String, | ||
} | ||
|
||
impl Default for TypeFastApp { | ||
fn default() -> Self { | ||
Self { | ||
// Example stuff: | ||
label: "Hello World!".to_owned(), | ||
} | ||
} | ||
} | ||
|
||
impl TypeFastApp { | ||
/// Called once before the first frame. | ||
pub fn new(cc: &eframe::CreationContext<'_>) -> Self { | ||
if let Some(storage) = cc.storage { | ||
return eframe::get_value(storage, eframe::APP_KEY).unwrap_or_default(); | ||
} | ||
|
||
Default::default() | ||
} | ||
} | ||
|
||
impl eframe::App for TypeFastApp { | ||
/// Called each time the UI needs repainting, which may be many times per second. | ||
/// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`. | ||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { | ||
let Self { label: _} = self; | ||
|
||
// Examples of how to create different panels and windows. | ||
// Pick whichever suits you. | ||
// Tip: a good default choice is to just keep the `CentralPanel`. | ||
// For inspiration and more examples, go to https://emilk.github.io/egui | ||
|
||
egui::TopBottomPanel::top("top_panel").show(ctx, |ui| { | ||
// The top panel is often a good place for a menu bar: | ||
egui::menu::bar(ui, |ui| { | ||
ui.menu_button("File", |ui| { | ||
if ui.button("Quit").clicked() { | ||
_frame.close(); | ||
} | ||
}); | ||
}); | ||
}); | ||
|
||
egui::SidePanel::left("side_panel_1").show(ctx, |ui| { | ||
ui.heading("Left"); | ||
} ); | ||
|
||
|
||
|
||
egui::SidePanel::right("side_panel_0").show(ctx, |ui| { | ||
ui.heading("Right"); | ||
|
||
|
||
|
||
ui.with_layout(egui::Layout::bottom_up(egui::Align::LEFT), |ui| { | ||
ui.horizontal(|ui| { | ||
ui.spacing_mut().item_spacing.x = 0.0; | ||
ui.label("TypeFast"); | ||
}); | ||
}); | ||
}); | ||
|
||
egui::CentralPanel::default().show(ctx, |ui| { | ||
|
||
ui.heading("central"); | ||
|
||
}); | ||
} | ||
|
||
/// Called by the frame work to save state before shutdown. | ||
fn save(&mut self, storage: &mut dyn eframe::Storage) { | ||
eframe::set_value(storage, eframe::APP_KEY, self); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
fn main() { | ||
println!("Hello, world!"); | ||
#![warn(clippy::all, rust_2018_idioms)] | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release | ||
|
||
use crate::app::TypeFastApp; | ||
|
||
mod app; | ||
|
||
|
||
fn main() -> eframe::Result<()> { | ||
// Log to stdout (if you run with `RUST_LOG=debug`). | ||
tracing_subscriber::fmt::init(); | ||
|
||
let native_options = eframe::NativeOptions::default(); | ||
eframe::run_native( | ||
"TypeFast", | ||
native_options, | ||
Box::new(|cc| Box::new(TypeFastApp::new(cc))), | ||
) | ||
} |