instructions
This commit is contained in:
parent
91f0aa479b
commit
25eb6bf446
20
src/main.rs
20
src/main.rs
|
@ -46,18 +46,23 @@ fn main() -> Result<(), String> {
|
||||||
let filename = if argv.len() > 1 {
|
let filename = if argv.len() > 1 {
|
||||||
argv[1].to_string()
|
argv[1].to_string()
|
||||||
} else {
|
} else {
|
||||||
show_simple_message_box(MessageBoxFlag::OK, title: &str, message: &str, window: W)
|
show_simple_message_box(
|
||||||
|
MessageBoxFlag::INFORMATION, "Welcome to Nestur!", INSTRUCTIONS, canvas.window()
|
||||||
|
).map_err(|e| e.to_string())?;
|
||||||
let name;
|
let name;
|
||||||
'waiting: loop {
|
'waiting: loop {
|
||||||
for event in event_pump.poll_iter() {
|
for event in event_pump.poll_iter() {
|
||||||
match event {
|
match event {
|
||||||
|
Event::Quit {..} | Event::KeyDown { keycode: Some(Keycode::Escape), .. }
|
||||||
|
=> return Ok(()),
|
||||||
Event::DropFile{ filename: f, .. } => {
|
Event::DropFile{ filename: f, .. } => {
|
||||||
name = f;
|
name = f;
|
||||||
break 'waiting;
|
break 'waiting;
|
||||||
},
|
},
|
||||||
_ => std::thread::sleep(Duration::from_millis(500)),
|
_ => (), // println!("event: {:?}", event),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::thread::sleep(Duration::from_millis(100));
|
||||||
}
|
}
|
||||||
name
|
name
|
||||||
};
|
};
|
||||||
|
@ -151,12 +156,6 @@ fn run_game(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_filename() -> String {
|
|
||||||
let argv: Vec<String> = std::env::args().collect();
|
|
||||||
assert!(argv.len() > 1, "must include .nes ROM as argument");
|
|
||||||
argv[1].clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn process_events(event_pump: &mut EventPump, filepath: &PathBuf, cpu: &mut Cpu) -> bool {
|
fn process_events(event_pump: &mut EventPump, filepath: &PathBuf, cpu: &mut Cpu) -> bool {
|
||||||
for event in event_pump.poll_iter() {
|
for event in event_pump.poll_iter() {
|
||||||
match event {
|
match event {
|
||||||
|
@ -191,6 +190,11 @@ fn process_events(event_pump: &mut EventPump, filepath: &PathBuf, cpu: &mut Cpu)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const INSTRUCTIONS: &str = "To play a game, drag an INES file (extension .nes) onto the main window.
|
||||||
|
To save the game state, press F5. To load the most recent save state, press F9.
|
||||||
|
To load another save state file, drag a .dat file onto the window while the game is running.
|
||||||
|
Battery-backed RAM saves (what the NES cartridges have) will be written to a .sav file if used.";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
|
Loading…
Reference in New Issue