Reimplemented sleep for 60 FPS.
This commit is contained in:
parent
c1515b2bb9
commit
f7de75a276
1 changed files with 5 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue