From a875e36df84b8b8aa0074fb9e08e7acc1108981c Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Fri, 25 Aug 2023 21:40:48 -0500 Subject: [PATCH] added a stylesheet (passed 10% of the size budget) also changed wasm name from pirates to index to save like 9 bytes also changed to "s" opt level to save like 9 bytes --- front/index.html | 1 + front/index.js | 2 +- front/style.css | 12 ++++++++++++ justfile | 3 ++- note | 8 -------- pirates/Cargo.toml | 4 ++++ 6 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 front/style.css delete mode 100644 note diff --git a/front/index.html b/front/index.html index 7a9803c..f8cff3c 100644 --- a/front/index.html +++ b/front/index.html @@ -3,6 +3,7 @@ + diff --git a/front/index.js b/front/index.js index 7d27a7e..aeb29e9 100644 --- a/front/index.js +++ b/front/index.js @@ -1,6 +1,6 @@ async function init() { const { instance } = await WebAssembly.instantiateStreaming( - fetch("./pirates.wasm") + fetch("./index.wasm") ); const width = 600; diff --git a/front/style.css b/front/style.css new file mode 100644 index 0000000..83fda7b --- /dev/null +++ b/front/style.css @@ -0,0 +1,12 @@ +body { + margin: 0; + background-color: #222222; +} + +#window { + display: block; + margin: auto; + height: 100vh; + max-width: 100vw; + image-rendering: crisp-edges; +} diff --git a/justfile b/justfile index 14defcd..eb5392d 100644 --- a/justfile +++ b/justfile @@ -3,13 +3,14 @@ alias r := run alias c := check-zip build: minify-js minify-rust minify-html + cp front/style.css build/style.css build-rust: cargo build --manifest-path pirates/Cargo.toml --target wasm32-unknown-unknown --release minify-rust: build-rust build-dir wasm-strip pirates/target/wasm32-unknown-unknown/release/pirates.wasm - wasm-opt -o build/pirates.wasm -Oz pirates/target/wasm32-unknown-unknown/release/pirates.wasm + wasm-opt -o build/index.wasm -Oz pirates/target/wasm32-unknown-unknown/release/pirates.wasm minify-js: build-dir #minify-js -m module --output build/index.js front/index.js diff --git a/note b/note deleted file mode 100644 index 8f62644..0000000 --- a/note +++ /dev/null @@ -1,8 +0,0 @@ -The next great period of piracy was the Middle Ages. In the 12th and 13th centuries trade in Europe was growing rapidly offering rich pickings for pirates. The English Channel was infested with pirates many of them operating from the Cinque Ports, Dover, Hastings, Hythe, Romney, and Sandwich. There were also pirates operating from ports like Dunkirk and Calais. There were also many pirates in the Indian Ocean and the Mediterranean. -https://localhistories.org/a-history-of-pirates/ - -caravel crew simulator with piracy mechanics? -takes place on the english channel - very small scale, crossings no more than 2 minuites -model ~15 ports - diff --git a/pirates/Cargo.toml b/pirates/Cargo.toml index 0a557fa..d865f45 100644 --- a/pirates/Cargo.toml +++ b/pirates/Cargo.toml @@ -3,6 +3,10 @@ name = "pirates" version = "0.1.0" edition = "2021" +[profile.release] +lto = true +opt-level = 's' + [lib] crate-type = ["cdylib"]