WASM build

This commit is contained in:
Pascal Engélibert 2024-01-03 22:24:53 +01:00
parent 572dfb6788
commit d6280343d5
2 changed files with 35 additions and 0 deletions

3
build-wasm.sh Normal file
View file

@ -0,0 +1,3 @@
cargo build --release --target wasm32-unknown-unknown || exit 1
echo "==> wasm-bindgen..."
wasm-bindgen --out-name jsb-gravity --out-dir target --target web target/wasm32-unknown-unknown/release/jsb-gravity.wasm || exit 1

32
index.html Normal file
View file

@ -0,0 +1,32 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>JSB Gravity</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
background-color: #222;
}
body {
display: flex;
flex-flow: column;
color: white;
}
#game {
order: 1;
max-width: 100vw;
max-height: 100vh;
margin: auto;
}
</style>
</head>
<body>
<canvas id="game">Canvas did not load.</canvas>
<script type="module">
import init from './target/jsb-gravity.js'
init()
</script>
</body>
</html>