This commit is contained in:
gallant 2023-04-09 21:39:26 -05:00
parent 9d2c2b2e2b
commit 7e056d0116
3 changed files with 7 additions and 8 deletions

View file

@ -1,4 +1,3 @@
use native_tls;
use std::env; use std::env;
use std::fs::{File, OpenOptions}; use std::fs::{File, OpenOptions};
use std::io::{copy, BufWriter}; use std::io::{copy, BufWriter};
@ -97,7 +96,7 @@ pub fn download_files(path: &Path,url: &str) -> Result<File, Box<dyn std::error:
.split("; ") .split("; ")
.find(|s| s.starts_with("filename=")) .find(|s| s.starts_with("filename="))
.unwrap() .unwrap()
.split("=") .split('=')
.nth(1) .nth(1)
.unwrap() .unwrap()
.trim_matches('"'); .trim_matches('"');
@ -105,7 +104,7 @@ pub fn download_files(path: &Path,url: &str) -> Result<File, Box<dyn std::error:
// Create a new File object to store the downloaded zip file // Create a new File object to store the downloaded zip file
let mut path = path.to_path_buf(); let mut path = path.to_path_buf();
path.push(&file_name); path.push(file_name);
let file = OpenOptions::new() let file = OpenOptions::new()
.read(true) .read(true)
.write(true) .write(true)

View file

@ -747,8 +747,8 @@ impl Game {
///}).unwrap(); ///}).unwrap();
///``` ///```
pub fn step(&self) -> u128 { pub fn step(&self) -> u128 {
let a = self.time.get().elapsed().as_millis().clone(); self.time.get().elapsed().as_millis()
a
} }
///Resets in-game timer ///Resets in-game timer

View file

@ -24,11 +24,11 @@ fn main() {
game.run(|ctx| { game.run(|ctx| {
if game.step() >= 1 { if game.step() >= 1 {
i = (i + 1) % 255; i = (i + 1) % 255;
ctx.set_background_colour(i as u8, 64, 255); ctx.set_background_colour(i, 64, 255);
draw_text( draw_text(
ctx, ctx,
format!("i is {}", i), format!("i is {i}"),
"MesloLGS NF Regular.ttf", "MesloLGS NF Regular.ttf",
72, 72,
(300, 300), (300, 300),
@ -80,7 +80,7 @@ fn main() {
} }
if !cat_box::physics::check_for_collision_with_collection(&s2, &coll).is_empty() { if !cat_box::physics::check_for_collision_with_collection(&s2, &coll).is_empty() {
println!("Sprites collided! {}", i); println!("Sprites collided! {i}");
} }
game.t_reset(); game.t_reset();