Fix Underflow bug, and require game path in arg
This commit is contained in:
parent
6fffa6fac5
commit
3bbd896e18
|
@ -19,7 +19,8 @@ fn main() {
|
|||
let window = init_window(&event_loop);
|
||||
let mut pixels = init_pixels(&window);
|
||||
|
||||
let rom_path = Path::new("./games/c8games/INVADERS");
|
||||
let path = std::env::args().nth(1).expect("No Path Provided!");
|
||||
let rom_path = Path::new(&path);
|
||||
chip8.load_rom(rom_path).expect("Unable to load ROM");
|
||||
|
||||
TimerManager::start();
|
||||
|
|
|
@ -137,14 +137,14 @@ impl Timer {
|
|||
|
||||
pub fn tick(&mut self) {
|
||||
if self.enabled {
|
||||
self.remaining -= 1;
|
||||
|
||||
if self.remaining == 0 {
|
||||
self.enabled = false;
|
||||
|
||||
if self.beep_enabled {
|
||||
Self::beep();
|
||||
}
|
||||
} else {
|
||||
self.remaining -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue