Compare commits
19 Commits
v0.4.0
...
8346527d05
| Author | SHA1 | Date | |
|---|---|---|---|
| 8346527d05 | |||
| 6329d000f5 | |||
| 46892ec32c | |||
| f6c6f26b8b | |||
| 9f8598c794 | |||
| b64771f3fc | |||
| d1941217c4 | |||
| ba5183b30d | |||
| 3e3bbd973f | |||
| 5abe894354 | |||
| 86483497e9 | |||
| 3f6a4ae532 | |||
| 7a5148dc74 | |||
| 8d4b033922 | |||
| 0c915b025e | |||
| 15a1d5c6de | |||
| e7e5337f22 | |||
| e65deec5ea | |||
| 29d0b644ec |
@@ -34,44 +34,6 @@ jobs:
|
||||
components: rustfmt
|
||||
- name: cargo fmt --check
|
||||
run: cargo fmt --check
|
||||
clippy:
|
||||
runs-on: ubuntu-latest
|
||||
name: ${{ matrix.toolchain }} / clippy
|
||||
permissions:
|
||||
contents: read
|
||||
checks: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Get early warning of new lints which are regularly introduced in beta channels.
|
||||
toolchain: [stable, beta]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install ${{ matrix.toolchain }}
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
components: clippy
|
||||
- name: cargo clippy
|
||||
uses: giraffate/clippy-action@v1
|
||||
with:
|
||||
reporter: 'github-pr-check'
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
semver:
|
||||
runs-on: ubuntu-latest
|
||||
name: semver
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt
|
||||
- name: cargo-semver-checks
|
||||
uses: obi1kenobi/cargo-semver-checks-action@v2
|
||||
doc:
|
||||
# run docs generation on nightly rather than stable. This enables features like
|
||||
# https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html which allows an
|
||||
@@ -116,7 +78,7 @@ jobs:
|
||||
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
|
||||
strategy:
|
||||
matrix:
|
||||
msrv: ["1.79.0"]
|
||||
msrv: ["1.87.0"]
|
||||
name: ubuntu / ${{ matrix.msrv }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
50
Cargo.lock
generated
50
Cargo.lock
generated
@@ -142,7 +142,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "another-boids-in-rust"
|
||||
version = "0.4.0"
|
||||
version = "0.6.0"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"bevy_spatial",
|
||||
@@ -1489,9 +1489,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.10.1"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
||||
checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
|
||||
|
||||
[[package]]
|
||||
name = "calloop"
|
||||
@@ -1509,9 +1509,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.43"
|
||||
version = "1.2.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2"
|
||||
checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
@@ -1963,9 +1963,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "erased-serde"
|
||||
version = "0.4.8"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "259d404d09818dec19332e31d94558aeb442fea04c817006456c24b5460bbd4b"
|
||||
checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_core",
|
||||
@@ -2029,9 +2029,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127"
|
||||
checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
|
||||
|
||||
[[package]]
|
||||
name = "fixedbitset"
|
||||
@@ -2063,9 +2063,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "font-types"
|
||||
version = "0.10.0"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "511e2c18a516c666d27867d2f9821f76e7d591f762e9fc41dd6cc5c90fe54b0b"
|
||||
checksum = "39a654f404bbcbd48ea58c617c2993ee91d1cb63727a37bf2323a4edeed1b8c5"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
@@ -2455,9 +2455,9 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||
|
||||
[[package]]
|
||||
name = "image"
|
||||
version = "0.25.8"
|
||||
version = "0.25.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "529feb3e6769d234375c4cf1ee2ce713682b8e76538cb13f9fc23e1400a591e7"
|
||||
checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"byteorder-lite",
|
||||
@@ -3269,9 +3269,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "orbclient"
|
||||
version = "0.3.48"
|
||||
version = "0.3.49"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba0b26cec2e24f08ed8bb31519a9333140a6599b867dac464bb150bdb796fd43"
|
||||
checksum = "247ad146e19b9437f8604c21f8652423595cf710ad108af40e77d3ae6e96b827"
|
||||
dependencies = [
|
||||
"libredox",
|
||||
]
|
||||
@@ -3501,9 +3501,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.41"
|
||||
version = "1.0.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
|
||||
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -3568,9 +3568,9 @@ checksum = "c3d6831663a5098ea164f89cff59c6284e95f4e3c76ce9848d4529f5ccca9bde"
|
||||
|
||||
[[package]]
|
||||
name = "rangemap"
|
||||
version = "1.6.0"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93e7e49bb0bf967717f7bd674458b3d6b0c5f48ec7e3038166026a69fc22223"
|
||||
checksum = "acbbbbea733ec66275512d0b9694f34102e7d5406fdbe2ad8d21b28dce92887c"
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
@@ -3758,9 +3758,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ruzstd"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3640bec8aad418d7d03c72ea2de10d5c646a598f9883c7babc160d91e3c1b26c"
|
||||
checksum = "e5ff0cc5e135c8870a775d3320910cd9b564ec036b4dc0b8741629020be63f01"
|
||||
dependencies = [
|
||||
"twox-hash",
|
||||
]
|
||||
@@ -3979,9 +3979,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.108"
|
||||
version = "2.0.110"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
|
||||
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4297,9 +4297,9 @@ checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-properties"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"
|
||||
checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-script"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "another-boids-in-rust"
|
||||
version = "0.4.0"
|
||||
version = "0.6.0"
|
||||
edition = "2024"
|
||||
license = "AGPL-3.0-only"
|
||||
|
||||
|
||||
11
Dockerfile
11
Dockerfile
@@ -1,19 +1,12 @@
|
||||
FROM rust:1.89 AS builder
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --no-install-recommends libasound2-dev libudev-dev
|
||||
RUN rustup target add wasm32-unknown-unknown
|
||||
RUN cargo install --locked wasm-bindgen-cli
|
||||
|
||||
# Copy only the package manifest and source code. Otherwise changes to anything
|
||||
# will cause Docker to re-run `cargo build` even when the source hasn't changed.
|
||||
COPY src/ ./src
|
||||
COPY Cargo.toml ./Cargo.toml
|
||||
COPY Cargo.lock ./Cargo.lock
|
||||
COPY . .
|
||||
|
||||
RUN cargo build --locked --target wasm32-unknown-unknown --profile=wasm-release
|
||||
RUN wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name "boids" target/wasm32-unknown-unknown/wasm-release/another-boids-in-rust.wasm
|
||||
COPY www/index.html out/index.html
|
||||
RUN make -j
|
||||
|
||||
FROM busybox:musl
|
||||
RUN mkdir -p /var/www
|
||||
|
||||
73
Makefile
Normal file
73
Makefile
Normal file
@@ -0,0 +1,73 @@
|
||||
# This script produces a web build. If you aren't trying to do that, it is
|
||||
# entirely useless to you.
|
||||
|
||||
# Patch these to select a different build profile or target
|
||||
# The target shouldn't change any time soon. WASM64, I guess. Other targets
|
||||
# aren't aimed at the web, so you shouldn't be using this makefile.
|
||||
CARGO_TARGET := wasm32-unknown-unknown
|
||||
CARGO_PROFILE := wasm-release
|
||||
|
||||
# Override DESTDIR to set a custom install path (such as your web root)
|
||||
DESTDIR ?= .
|
||||
|
||||
SRC_DIR = ./src
|
||||
SRCS := $(wildcard $(SRC_DIR)/**)
|
||||
|
||||
.PHONY: clean full-clean install tarball tarball-standalone web web-standalone
|
||||
|
||||
# "Standalone" version
|
||||
# (i.e., it includes an index.html so it can be placed on a server as-is)
|
||||
web-standalone: out/boids.js out/boids_bg.wasm.gz out/index.html
|
||||
|
||||
# "Bundle-able" version. The host site must provide it's own HTML page.
|
||||
web: out/boids.js out/boids_bg.wasm.gz out/boids.html
|
||||
|
||||
tarball: boids_web_root.tar
|
||||
|
||||
tarball_standalone: boids_web_root_standalone.tar
|
||||
|
||||
boids_web_root.tar: out/boids.js out/boids_bg.wasm.gz out/boids.html
|
||||
tar -caf $@ $^
|
||||
|
||||
boids_web_root_standalone.tar: out/boids.js out/boids_bg.wasm.gz out/index.html
|
||||
tar -caf $@ $^
|
||||
|
||||
target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm: $(SRCS) Cargo.lock Cargo.toml
|
||||
cargo build --profile $(CARGO_PROFILE) --target $(CARGO_TARGET)
|
||||
|
||||
out:
|
||||
mkdir $@
|
||||
|
||||
# Both the JS and WASM files are generated by the wasm-bindgen call, so both
|
||||
# get to be on the target half of this recipe.
|
||||
out/boids.js out/boids_bg.wasm.gz &: target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm | out
|
||||
wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name boids target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm
|
||||
gzip -9 -f out/boids_bg.wasm
|
||||
|
||||
# Copies the index page to the output
|
||||
out/index.html: www/index.html
|
||||
cp -a $< $@
|
||||
rm -f out/boids.html
|
||||
|
||||
# Like `out/index.html`, but renames it for use in a larger site.
|
||||
out/boids.html: www/index.html
|
||||
cp -a $< $@
|
||||
rm -f out/index.html
|
||||
|
||||
# Clean the web build, but not the Cargo cache. Cargo handles it's own caching
|
||||
# and I don't want to obliterate it all the time.
|
||||
clean:
|
||||
rm -rf out/ boids_web_root.tar boids_web_root_standalone.tar
|
||||
|
||||
# Delete everything, including the Cargo build cache. In case someone needs
|
||||
# this, I guess.
|
||||
full-clean: clean
|
||||
cargo clean
|
||||
|
||||
# Installation goal. It's meant to be a helper utility for moving the built
|
||||
# output into the web root. Only supports the "bundle-able" mode.
|
||||
install: web
|
||||
install -dm0755 $(DESTDIR)
|
||||
install -m0644 out/boids.js $(DESTDIR)/
|
||||
install -m0644 out/boids_bg.wasm.gz $(DESTDIR)/
|
||||
install -m0644 out/boids.html $(DESTDIR)/
|
||||
36
README.md
36
README.md
@@ -21,13 +21,42 @@ You'll need a working Rust toolchain, of course. See the [rustup](https://rustup
|
||||
|
||||
### Web
|
||||
|
||||
This project creates a "static site," meaning a complete deployment of the site is simply copying the output folder onto a webserver.
|
||||
This project creates a "static site," meaning a complete deployment of the site is simply copying the output folder onto a webserver. There are **two** ways to use this.
|
||||
|
||||
1. Build `make -f ./makefile_web web`
|
||||
1. A standalone application which can be quickly hosted as-is. This includes the WASM, it's JS glue, and an index.html page.
|
||||
2. A sub-page in a larger website. This is actually the same, but names it's HTML page "boids.html" so consumers (you) can provide their own index.html.
|
||||
- I'm not using a JS Bundler at this time. If you're familiar with JS development, this probably looks like a dumb way to do it. Sorry about that.
|
||||
|
||||
#### Standalone build:
|
||||
|
||||
1. Build `make web-standalone`
|
||||
2. Serve `python3 -m http.server -d ./out`
|
||||
3. Visit site in browser: `http://localhost:8000`
|
||||
|
||||
You can use any HTTP server you like. Here, I'm using the Python3 built-in [http.server module](https://docs.python.org/3/library/http.server.html); which is **NOT** recommended for production use. Don't put that on the Internet! Alternatives include [Miniserve](https://crates.io/crates/miniserve) and [BusyBox](https://busybox.net/). The latter of which I'm using in the Docker image.
|
||||
To quickly get a tarball, use `make tarball_standalone`. If you're trying to build and upload the program somewhere, this may provide a bit of convenience. Compressing it may be a good idea, too.
|
||||
|
||||
#### "Bundle-able" build
|
||||
|
||||
For a "bundle-able" build, you'll need to write your own index.html and link to the boids.html file.
|
||||
|
||||
Basically, just throw in a hyperlink with `<a href="boids.html">Boids</a>`
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!-- your page content, etc -->
|
||||
<body>
|
||||
<a href="boids.html">Boids</a>
|
||||
</body>
|
||||
<!-- more page content, etc -->
|
||||
</html>
|
||||
```
|
||||
|
||||
As mentioned in the option 2 description, I'm not using a JS Bundler. There is no "package.json" or anything to integrate properly with a JS framework. I plan to fix that at some point, but for now there are just a bunch of files to grab.
|
||||
|
||||
---
|
||||
|
||||
You can use any HTTP server you like. In the steps above, I'm using the Python3 built-in [http.server module](https://docs.python.org/3/library/http.server.html); which is **NOT** recommended for production use. Don't put that on the Internet! Alternatives include [Miniserve](https://crates.io/crates/miniserve) and [BusyBox](https://busybox.net/). The latter of which I'm using in the Docker image.
|
||||
|
||||
### Web, but as a Docker Container
|
||||
|
||||
@@ -45,6 +74,7 @@ You may also notice that the Dockerfile doesn't call on the Makefile. This is be
|
||||
## Controls
|
||||
|
||||
| Input | Effect |
|
||||
|-|-|
|
||||
| Mouse | The scanner circle is attached to the mouse cursor. Move it to scan boids within the radius. |
|
||||
| Left mouse button | Put scanner into center-of-mass mode |
|
||||
| Right mouse button | Put scanner into average velocity mode |
|
||||
|
||||
25
fly.toml
25
fly.toml
@@ -1,25 +0,0 @@
|
||||
# fly.toml app configuration file generated for boids-autumn-lake-5810 on 2025-09-03T16:02:00-05:00
|
||||
#
|
||||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
|
||||
#
|
||||
|
||||
app = 'boids-autumn-lake-5810'
|
||||
primary_region = 'ord'
|
||||
|
||||
[build]
|
||||
|
||||
[env]
|
||||
PORT = '8080'
|
||||
|
||||
[http_service]
|
||||
internal_port = 8080
|
||||
force_https = true
|
||||
auto_stop_machines = 'stop'
|
||||
auto_start_machines = true
|
||||
min_machines_running = 0
|
||||
processes = ['app']
|
||||
|
||||
[[vm]]
|
||||
memory = '256mb'
|
||||
cpu_kind = 'shared'
|
||||
cpus = 1
|
||||
41
makefile_web
41
makefile_web
@@ -1,41 +0,0 @@
|
||||
SRC_DIR = ./src
|
||||
SRCS := $(wildcard $(SRC_DIR)/**)
|
||||
|
||||
# Patch these to select a different build profile or target
|
||||
# The target shouldn't change any time soon. WASM64, I guess. Other targets
|
||||
# aren't aimed at the web, so you shouldn't be using this makefile.
|
||||
CARGO_TARGET := wasm32-unknown-unknown
|
||||
CARGO_PROFILE := wasm-release
|
||||
|
||||
.PHONY: clean full-clean web tarball
|
||||
|
||||
web: out/boids.js out/boids_bg.wasm out/index.html
|
||||
|
||||
tarball: boids_web_root.tar
|
||||
|
||||
boids_web_root.tar: out/boids.js out/boids_bg.wasm out/index.html
|
||||
tar -caf $@ $^
|
||||
|
||||
target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm: $(SRCS) Cargo.lock Cargo.toml
|
||||
cargo build --profile $(CARGO_PROFILE) --target $(CARGO_TARGET)
|
||||
|
||||
out:
|
||||
mkdir $@
|
||||
|
||||
# Both the JS and WASM files are generated by the wasm-bindgen call, so both
|
||||
# get to be on the target half of this recipe.
|
||||
out/boids.js out/boids_bg.wasm &: target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm | out
|
||||
wasm-bindgen --no-typescript --target web --out-dir ./out/ --out-name boids target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm
|
||||
|
||||
out/index.html: www/index.html
|
||||
cp -a $< $@
|
||||
|
||||
# Clean the web build, but not the Cargo cache. Cargo handles it's own caching
|
||||
# and I don't want to obliterate it all the time.
|
||||
clean:
|
||||
rm -rf out/ boids_web_root.tar
|
||||
|
||||
# Delete everything, including the Cargo build cache. In case someone needs
|
||||
# this, I guess.
|
||||
full-clean: clean
|
||||
cargo clean
|
||||
@@ -1,16 +1,28 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
body {
|
||||
background-color: hsl(100, 10%, 60%);
|
||||
color: hsl(0, 0%, 15%);
|
||||
}
|
||||
h1 {
|
||||
background-color: rgb(72, 97, 72);
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
padding: 0.5em;
|
||||
}
|
||||
canvas {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
margin-top: 1em;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
display: block;
|
||||
outline-color: hsl(100, 100%, 15%);
|
||||
outline-style: outset;
|
||||
border-radius: 8px;
|
||||
background-color: rgb(40%, 40%, 40%);
|
||||
}
|
||||
main {
|
||||
margin-left: auto;
|
||||
@@ -18,11 +30,12 @@
|
||||
width: 70%;
|
||||
}
|
||||
table {
|
||||
margin-bottom: 10px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid;
|
||||
padding: 2px 4px;
|
||||
padding: 0.1em 0.3em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -91,7 +104,7 @@
|
||||
<tr>
|
||||
<td>Program Version</td>
|
||||
<!-- This version text is completely unchecked. I'll need to do something about that. -->
|
||||
<td><code>v0.4.0</code></td>
|
||||
<td><code>v0.6.0</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
</article>
|
||||
@@ -99,7 +112,11 @@
|
||||
<script type="module">
|
||||
import init from './boids.js'
|
||||
|
||||
init().catch((error) => {
|
||||
let compressed = await fetch("./boids_bg.wasm.gz")
|
||||
let wasm_stream = compressed.body.pipeThrough(new DecompressionStream("gzip"))
|
||||
let blob = await new Response(wasm_stream).blob();
|
||||
|
||||
init(await blob.arrayBuffer()).catch((error) => {
|
||||
if (!error.message.startsWith("Using exceptions for control flow, don't mind me. This isn't actually an error!")) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user