-
Notifications
You must be signed in to change notification settings - Fork 14
/
main.rs
44 lines (38 loc) · 1.04 KB
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
extern crate logger;
extern crate ui;
use logger::log;
#[cfg(feature = "logger")]
use logger::{init_logger, LogKind};
fn main() {
let args = std::env::args().skip(1).collect::<Vec<String>>();
#[cfg(feature = "logger")]
if args.len() > 1 {
if args.last().unwrap().as_str() == "--log-on-file" {
init_logger(LogKind::FILE);
}
} else {
init_logger(LogKind::STDOUT);
}
let cartridge_name = args.first().map_or_else(
|| {
log("no cartridge found :(");
std::process::exit(1)
},
|name| {
log(format!("loading {name}"));
name.clone()
},
);
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default()
.with_inner_size([1200.0, 800.0])
.with_drag_and_drop(true),
..Default::default()
};
eframe::run_native(
"Clementine - A GBA Emulator",
options,
Box::new(|_cc| Ok(Box::new(ui::app::App::new(cartridge_name)))),
)
.ok();
}