Skip to content

Commit

Permalink
Merge pull request #23 from oiwn/dev
Browse files Browse the repository at this point in the history
update deps
  • Loading branch information
oiwn authored Aug 21, 2024
2 parents fb8f747 + c23482a commit 3cf92e4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ Cargo.lock
*.profraw

# misc
tmp/
tags
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tarts" # shortcut from Terminal Arts
version = "0.1.6"
version = "0.1.7"
edition = "2021"

authors = ["oiwn <[email protected]>"]
Expand All @@ -13,9 +13,9 @@ homepage = "https://github.com/oiwn/tui-screen-savers-rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
crossterm = "0.27"
derive_builder = "0.12"
once_cell = "1.18"
crossterm = "0.28"
derive_builder = "0.20"
once_cell = "1.19"
pico-args = "0.5"
rand = "0.8"
tracing = "0.1"
Expand All @@ -32,6 +32,6 @@ harness = false
[profile.release]
panic = "abort"
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
opt-level = "s" # Optimize for size.
lto = true # enable link time optimization
codegen-units = 1
Empty file added Justfile
Empty file.
16 changes: 0 additions & 16 deletions Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions benches/rain_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn run_loop_benchmark(_c: &mut Criterion) {

fn vertical_worm_benchmark(c: &mut Criterion) {
let options = get_sane_options();
c.bench_function("benchmark_worm_new_1000", |b| {
c.bench_function("benchmark_raindrop_new_1000", |b| {
b.iter(|| {
let mut rng = rand::thread_rng();
for index in 1..=1000 {
Expand All @@ -43,7 +43,7 @@ fn vertical_worm_benchmark(c: &mut Criterion) {
})
});

c.bench_function("benchmark_worm_update_1000", |b| {
c.bench_function("benchmark_raindrop_update_1000", |b| {
let mut rng = rand::thread_rng();
let options = get_sane_options();
let mut drops: Vec<rain_drop::RainDrop> = vec![];
Expand Down
4 changes: 3 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ where

// calculate actual frame rate
let ended_at = std::time::SystemTime::now();
let delta = ended_at.duration_since(started_at).unwrap();
let delta = ended_at
.duration_since(started_at)
.unwrap_or(std::time::Duration::from_secs(0));
frames_per_second = (frames_per_second + (1.0 / delta.as_secs_f64())) / 2.0;

if delta < target_frame_duration {
Expand Down
11 changes: 6 additions & 5 deletions src/life/conway_life.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,21 @@ impl LifeCell {
) {
let green_color = 255_u8.wrapping_sub(current_gen);
match current_gen {
0..=250 => {
0..=230 => {
self.color = style::Color::Rgb {
r: 0,
g: green_color,
b: 0,
}; // Green
self.character = '*';
let random_index = rng.gen_range(0..DEAD_CELLS_CHARS.len());
self.character = *DEAD_CELLS_CHARS.get(random_index).unwrap();
}
_ => {
self.color = style::Color::Rgb {
r: 128,
r: 0,
g: green_color,
b: 128,
}; // Purple
b: 0,
};
let random_index = rng.gen_range(0..DEAD_CELLS_CHARS.len());
self.character = *DEAD_CELLS_CHARS.get(random_index).unwrap();
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ fn main() -> std::io::Result<()> {
.screen_size((width, height))
.build()
.unwrap();
let mut wilson_maze = maze::Maze::new(options);
common::run_loop(&mut stdout, &mut wilson_maze, None)?
let mut maze = maze::Maze::new(options);
common::run_loop(&mut stdout, &mut maze, None)?
}
"check" => {
let options = check::CheckOptionsBuilder::default()
Expand Down

0 comments on commit 3cf92e4

Please sign in to comment.