From 95467cb94fcddcf72dbfe84dfb564cc70675409b Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Tue, 7 May 2024 13:32:43 +0200 Subject: [PATCH] implement FPS variable --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index d069954..b608122 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ pub const BRIGHTNESS: &str = "$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\\|()1{}[]?-_+~<>i!lI;:,\"^`'. "; pub const HEIGHT: u32 = 25; // Max: 35 pub const WIDTH: u32 = 25; // Max: 145 +pub const FPS: u32 = 10; pub const K1: u32 = 2; pub const K2: u32 = 3; pub const G: u32 = 35; @@ -19,6 +20,6 @@ fn main() { print!("{esc}[2J{esc}[1;1H", esc = 27 as char); display_grid(&grid); update_grid(&mut grid); - thread::sleep(Duration::from_millis(100)); + thread::sleep(Duration::from_millis(1000 / (FPS as u64))); } }