1
Fork 0

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
This commit is contained in:
Andy Killorin 2023-08-25 21:40:48 -05:00
parent 63f6a46482
commit a875e36df8
Signed by: ank
GPG key ID: B6241CA3B552BCA4
6 changed files with 20 additions and 10 deletions

View file

@ -3,6 +3,7 @@
<head> <head>
<script type="module" src="index.js"> <script type="module" src="index.js">
</script> </script>
<link rel="stylesheet" href="style.css">
</head> </head>
<body> <body>
<canvas id="window"></canvas> <canvas id="window"></canvas>

View file

@ -1,6 +1,6 @@
async function init() { async function init() {
const { instance } = await WebAssembly.instantiateStreaming( const { instance } = await WebAssembly.instantiateStreaming(
fetch("./pirates.wasm") fetch("./index.wasm")
); );
const width = 600; const width = 600;

12
front/style.css Normal file
View file

@ -0,0 +1,12 @@
body {
margin: 0;
background-color: #222222;
}
#window {
display: block;
margin: auto;
height: 100vh;
max-width: 100vw;
image-rendering: crisp-edges;
}

View file

@ -3,13 +3,14 @@ alias r := run
alias c := check-zip alias c := check-zip
build: minify-js minify-rust minify-html build: minify-js minify-rust minify-html
cp front/style.css build/style.css
build-rust: build-rust:
cargo build --manifest-path pirates/Cargo.toml --target wasm32-unknown-unknown --release cargo build --manifest-path pirates/Cargo.toml --target wasm32-unknown-unknown --release
minify-rust: build-rust build-dir minify-rust: build-rust build-dir
wasm-strip pirates/target/wasm32-unknown-unknown/release/pirates.wasm 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: build-dir
#minify-js -m module --output build/index.js front/index.js #minify-js -m module --output build/index.js front/index.js

8
note
View file

@ -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

View file

@ -3,6 +3,10 @@ name = "pirates"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
[profile.release]
lto = true
opt-level = 's'
[lib] [lib]
crate-type = ["cdylib"] crate-type = ["cdylib"]