diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cfbae61..ea9272b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -17,8 +17,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Install xmllint - run: sudo apt-get install libxcb-composite0-dev + - name: Install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install -y libfontconfig-dev libxcb-composite0-dev - uses: actions/checkout@v2 - name: Build run: cargo build --verbose --examples --tests --features serde_support diff --git a/Cargo.toml b/Cargo.toml index 7ed5311..b022ae7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,9 @@ serde = {version = "1.0.163", features = ["derive"], optional = true} strum = {version = "0.27.2", optional = true} strum_macros = {version ="0.27.2", optional = true} +[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] +web-time = "1.1" + [features] serde_support = ["serde", "strum", "strum_macros"] diff --git a/README.md b/README.md index 5afc897..adb7aa7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A native port of [Box2D](https://github.com/erincatto/box2d) to Rust. -Minimum Rust version: 1.56.0 (1.61 for dev-dependecies) +Minimum Rust version: 1.56.0 (1.61 for dev-dependecies, 1.60 for `wasm32-unknown-unknown` support) Ported Box2D version: 2.4.2 diff --git a/examples/testbed/main_loop.rs b/examples/testbed/main_loop.rs index 1a19c91..8c5613b 100644 --- a/examples/testbed/main_loop.rs +++ b/examples/testbed/main_loop.rs @@ -572,7 +572,7 @@ impl System { TabItem::new("Tests").build(ui, || { let tests = &g_test_entries; - for (key, group) in &tests.into_iter().group_by(|v| v.category) { + for (key, group) in &tests.into_iter().chunk_by(|v| v.category) { let category_selected: bool = g_test_entries[s_settings.m_test_index as usize].category == key; diff --git a/src/b2_timer.rs b/src/b2_timer.rs index 40eec6a..8d90ba7 100644 --- a/src/b2_timer.rs +++ b/src/b2_timer.rs @@ -1,4 +1,7 @@ +#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] use std::time::Instant; +#[cfg(all(target_arch = "wasm32", target_os = "unknown"))] +use web_time::Instant; pub struct B2timer { start: Instant,