Skip to content

Commit

Permalink
flexible size
Browse files Browse the repository at this point in the history
  • Loading branch information
wjwei-handsome committed Dec 22, 2023
1 parent 3efc587 commit 7b29438
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ fn main() {

// Setup
terminal::enable_raw_mode().unwrap();
// Get terminal size
let size = terminal::size().unwrap();
let width = size.0;
let height = size.1;

// Clear the terminal
execute!(stdout(), terminal::Clear(ClearType::All), cursor::Hide).unwrap();
Expand All @@ -113,6 +109,11 @@ fn main() {
let mut snowflakes: Vec<Snowflake> = Vec::new();

loop {
// Get terminal size
let size = terminal::size().unwrap();
let width = size.0;
let height = size.1;

// Generate new snowflake
let new_snowflake = get_snowflake(random, rainbow, width);
snowflakes.push(new_snowflake);
Expand Down

0 comments on commit 7b29438

Please sign in to comment.