diff --git a/src/main.rs b/src/main.rs index 2e99db0..e3f1528 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,7 @@ const TOTAL_GLYPH_ATLASES: u8 = 16 * 8; // Total screen blocks = GLYPH_COLUMNS * GLYPH_ROWS const TOTAL_SCREEN_BLOCKS: usize = 2000; -const FPS_60_HERTZ: u32 = 1_000_000_000u32 / 60; +const REFRESH_RATE: u32 = 1_000_000_000u32 / 60; const BLINK_RATE: u128 = 266666666; #[derive(Clone, Copy)] @@ -257,8 +257,11 @@ pub fn main() { blink_tick += elapsed; } + if (elapsed as u32) < REFRESH_RATE { + sleep(Duration::new(0, REFRESH_RATE - elapsed as u32)); + } + render(&mut canvas, &atlases, &dos_screen, &blink_state); - //sleep(Duration::new(0, FPS_60_HERTZ)); prev_tick = curr_tick; }