Krolyxon
Commit 6ffb407

Branches

Tags

Refs →

bench51cratesbench51-guisrcmain.rs

66 lines · 1.6 KB · Rust

1// No console window behind the app on Windows release builds.
2#![cfg_attr(all(windows, not(debug_assertions)), windows_subsystem = "windows")]
3
4mod app;
5mod chrome;
6mod editor;
7mod icons;
8mod layout;
9mod modals;
10mod panes;
11mod state;
12mod theme;
13mod vim;
14mod widgets;
15
16use std::path::PathBuf;
17use std::sync::Arc;
18
19use clap::Parser;
20use eframe::egui;
21
22/// Keil µVision-style desktop IDE for the Intel 8051, built on bench51.
23#[derive(Parser, Debug)]
24#[command(version, about)]
25struct Args {
26 /// Assembly sources (.asm, .a51) or Intel HEX files (.hex, .ihx) to open.
27 files: Vec<PathBuf>,
28
29 /// Oscillator frequency in MHz, used to show elapsed time.
30 #[arg(long)]
31 clock: Option<f64>,
32
33 /// Colour theme, overriding the saved choice.
34 #[arg(long, value_enum)]
35 theme: Option<state::ThemePref>,
36
37 /// Editor keybindings, overriding the saved choice.
38 #[arg(long, value_enum)]
39 keymap: Option<state::Keymap>,
40}
41
42fn main() -> eframe::Result {
43 let args = Args::parse();
44 let options = eframe::NativeOptions {
45 viewport: egui::ViewportBuilder::default()
46 .with_title("bench51")
47 .with_app_id("bench51-gui")
48 .with_inner_size([1440.0, 900.0])
49 .with_min_inner_size([960.0, 600.0])
50 .with_icon(Arc::new(icons::app_icon())),
51 ..Default::default()
52 };
53 eframe::run_native(
54 "bench51-gui",
55 options,
56 Box::new(move |cc| {
57 Ok(Box::new(app::GuiApp::new(
58 cc,
59 args.files,
60 args.clock,
61 args.theme,
62 args.keymap,
63 )))
64 }),
65 )
66}