Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kilork committed Jun 4, 2024
1 parent 8b73f60 commit 5c93a50
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 19 deletions.
9 changes: 1 addition & 8 deletions kr-engne/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,14 @@ web-sys = { version = "0.3", features = [
'Performance',
'Window'
]}
rand = { version = "0.7", features = ["wasm-bindgen"] }
rand = { version = "0.8" }

# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.6", optional = true }

# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
#
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
wee_alloc = { version = "0.4.5", optional = true }

[dev-dependencies]
wasm-bindgen-test = "0.3"

Expand Down
2 changes: 0 additions & 2 deletions kr-engne/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,3 @@ wasm-pack publish
between WebAssembly and JavaScript.
* [`console_error_panic_hook`](https://github.com/rustwasm/console_error_panic_hook)
for logging panic messages to the developer console.
* [`wee_alloc`](https://github.com/rustwasm/wee_alloc), an allocator optimized
for small code size.
10 changes: 2 additions & 8 deletions kr-engne/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use web_sys::CanvasRenderingContext2d;

// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
Expand Down Expand Up @@ -107,7 +101,7 @@ impl Universum {
}

fn random(&mut self, high: i32) -> i32 {
self.rng.gen_range(0, high)
self.rng.gen_range(0..high)
}

/// Add default objects to scene
Expand All @@ -122,7 +116,7 @@ impl Universum {

// clouds
for _ in 0..10 {
let i = self.rng.gen_range(15, 40);
let i = self.rng.gen_range(15..40);
let cloud_color = self.random(256) as u8;
let z = self.random(5);
let nscene = self.create_cloud(-(i << 3), 30, i, i, LIGHT_GRAY, cloud_color, 32766 - z);
Expand Down
2 changes: 1 addition & 1 deletion kr-engne/src/obj_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl Universum {
dy: 64,
phase: 0,
old_time: Self::now(),
ph_time: vec![self.rng.gen_range(250.0, 500.0)],
ph_time: vec![self.rng.gen_range(250.0..500.0)],
set_phase: Self::set_phase_ovca,
drawme: Self::drawme_ovca,
inme: None,
Expand Down

0 comments on commit 5c93a50

Please sign in to comment.