-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.rs
38 lines (27 loc) · 788 Bytes
/
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
use std::path::PathBuf;
use structopt::StructOpt;
mod chip8;
use chip8::Chip8;
mod platform;
#[derive(Debug, StructOpt)]
#[structopt(name = "Example", about = "CHIP8-rs options")]
struct Opt {
/// Activate debug mode
// short and long flags (-d, --debug) will be deduced from the field's name
#[structopt(short, long)]
debug: bool,
/// Set speed
// we don't want to name it "speed", need to look smart
#[structopt(short = "c", long = "clock", default_value = "10")]
speed: u64,
/// Input file
#[structopt(short = "r", long = "rom", parse(from_os_str))]
rom: PathBuf,
}
fn main() {
let opt = Opt::from_args();
let mut chip8: Chip8 = Chip8::new();
//chip8.debug();
chip8.load_rom(opt.rom);
chip8.play(opt.speed);
}