Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8346527d05 | |||
| 6329d000f5 | |||
| 46892ec32c | |||
| f6c6f26b8b | |||
| 9f8598c794 | |||
| b64771f3fc |
@@ -34,44 +34,6 @@ jobs:
|
|||||||
components: rustfmt
|
components: rustfmt
|
||||||
- name: cargo fmt --check
|
- name: cargo fmt --check
|
||||||
run: 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:
|
doc:
|
||||||
# run docs generation on nightly rather than stable. This enables features like
|
# 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
|
# 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
|
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
msrv: ["1.79.0"]
|
msrv: ["1.87.0"]
|
||||||
name: ubuntu / ${{ matrix.msrv }}
|
name: ubuntu / ${{ matrix.msrv }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
30
Cargo.lock
generated
30
Cargo.lock
generated
@@ -142,7 +142,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "another-boids-in-rust"
|
name = "another-boids-in-rust"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bevy",
|
"bevy",
|
||||||
"bevy_spatial",
|
"bevy_spatial",
|
||||||
@@ -1489,9 +1489,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.10.1"
|
version = "1.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "calloop"
|
name = "calloop"
|
||||||
@@ -1509,9 +1509,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.2.45"
|
version = "1.2.46"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "35900b6c8d709fb1d854671ae27aeaa9eec2f8b01b364e1619a40da3e6fe2afe"
|
checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"find-msvc-tools",
|
"find-msvc-tools",
|
||||||
"jobserver",
|
"jobserver",
|
||||||
@@ -2029,9 +2029,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "find-msvc-tools"
|
name = "find-msvc-tools"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127"
|
checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fixedbitset"
|
name = "fixedbitset"
|
||||||
@@ -2063,9 +2063,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "font-types"
|
name = "font-types"
|
||||||
version = "0.10.0"
|
version = "0.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "511e2c18a516c666d27867d2f9821f76e7d591f762e9fc41dd6cc5c90fe54b0b"
|
checksum = "39a654f404bbcbd48ea58c617c2993ee91d1cb63727a37bf2323a4edeed1b8c5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
@@ -2455,9 +2455,9 @@ checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.25.8"
|
version = "0.25.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "529feb3e6769d234375c4cf1ee2ce713682b8e76538cb13f9fc23e1400a591e7"
|
checksum = "e6506c6c10786659413faa717ceebcb8f70731c0a60cbae39795fdf114519c1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"byteorder-lite",
|
"byteorder-lite",
|
||||||
@@ -3568,9 +3568,9 @@ checksum = "c3d6831663a5098ea164f89cff59c6284e95f4e3c76ce9848d4529f5ccca9bde"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rangemap"
|
name = "rangemap"
|
||||||
version = "1.6.0"
|
version = "1.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f93e7e49bb0bf967717f7bd674458b3d6b0c5f48ec7e3038166026a69fc22223"
|
checksum = "acbbbbea733ec66275512d0b9694f34102e7d5406fdbe2ad8d21b28dce92887c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raw-window-handle"
|
name = "raw-window-handle"
|
||||||
@@ -3979,9 +3979,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.109"
|
version = "2.0.110"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2f17c7e013e88258aa9543dcbe81aca68a667a9ac37cd69c9fbc07858bfe0e2f"
|
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "another-boids-in-rust"
|
name = "another-boids-in-rust"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "AGPL-3.0-only"
|
license = "AGPL-3.0-only"
|
||||||
|
|
||||||
|
|||||||
13
Makefile
13
Makefile
@@ -17,19 +17,19 @@ SRCS := $(wildcard $(SRC_DIR)/**)
|
|||||||
|
|
||||||
# "Standalone" version
|
# "Standalone" version
|
||||||
# (i.e., it includes an index.html so it can be placed on a server as-is)
|
# (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 out/index.html
|
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.
|
# "Bundle-able" version. The host site must provide it's own HTML page.
|
||||||
web: out/boids.js out/boids_bg.wasm out/boids.html
|
web: out/boids.js out/boids_bg.wasm.gz out/boids.html
|
||||||
|
|
||||||
tarball: boids_web_root.tar
|
tarball: boids_web_root.tar
|
||||||
|
|
||||||
tarball_standalone: boids_web_root_standalone.tar
|
tarball_standalone: boids_web_root_standalone.tar
|
||||||
|
|
||||||
boids_web_root.tar: out/boids.js out/boids_bg.wasm out/boids.html
|
boids_web_root.tar: out/boids.js out/boids_bg.wasm.gz out/boids.html
|
||||||
tar -caf $@ $^
|
tar -caf $@ $^
|
||||||
|
|
||||||
boids_web_root_standalone.tar: out/boids.js out/boids_bg.wasm out/index.html
|
boids_web_root_standalone.tar: out/boids.js out/boids_bg.wasm.gz out/index.html
|
||||||
tar -caf $@ $^
|
tar -caf $@ $^
|
||||||
|
|
||||||
target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm: $(SRCS) Cargo.lock Cargo.toml
|
target/$(CARGO_TARGET)/$(CARGO_PROFILE)/another-boids-in-rust.wasm: $(SRCS) Cargo.lock Cargo.toml
|
||||||
@@ -40,8 +40,9 @@ out:
|
|||||||
|
|
||||||
# Both the JS and WASM files are generated by the wasm-bindgen call, so both
|
# 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.
|
# 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
|
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
|
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
|
# Copies the index page to the output
|
||||||
out/index.html: www/index.html
|
out/index.html: www/index.html
|
||||||
@@ -68,5 +69,5 @@ full-clean: clean
|
|||||||
install: web
|
install: web
|
||||||
install -dm0755 $(DESTDIR)
|
install -dm0755 $(DESTDIR)
|
||||||
install -m0644 out/boids.js $(DESTDIR)/
|
install -m0644 out/boids.js $(DESTDIR)/
|
||||||
install -m0644 out/boids_bg.wasm $(DESTDIR)/
|
install -m0644 out/boids_bg.wasm.gz $(DESTDIR)/
|
||||||
install -m0644 out/boids.html $(DESTDIR)/
|
install -m0644 out/boids.html $(DESTDIR)/
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ Basically, just throw in a hyperlink with `<a href="boids.html">Boids</a>`
|
|||||||
```
|
```
|
||||||
|
|
||||||
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.
|
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.
|
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.
|
||||||
@@ -73,6 +74,7 @@ You may also notice that the Dockerfile doesn't call on the Makefile. This is be
|
|||||||
## Controls
|
## Controls
|
||||||
|
|
||||||
| Input | Effect |
|
| Input | Effect |
|
||||||
|
|-|-|
|
||||||
| Mouse | The scanner circle is attached to the mouse cursor. Move it to scan boids within the radius. |
|
| 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 |
|
| Left mouse button | Put scanner into center-of-mass mode |
|
||||||
| Right mouse button | Put scanner into average velocity mode |
|
| Right mouse button | Put scanner into average velocity mode |
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Program Version</td>
|
<td>Program Version</td>
|
||||||
<!-- This version text is completely unchecked. I'll need to do something about that. -->
|
<!-- This version text is completely unchecked. I'll need to do something about that. -->
|
||||||
<td><code>v0.5.0</code></td>
|
<td><code>v0.6.0</code></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</article>
|
</article>
|
||||||
@@ -112,7 +112,11 @@
|
|||||||
<script type="module">
|
<script type="module">
|
||||||
import init from './boids.js'
|
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!")) {
|
if (!error.message.startsWith("Using exceptions for control flow, don't mind me. This isn't actually an error!")) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user